Advertisement
Guest User

For rBrICK

a guest
Jul 23rd, 2014
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.21 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.List;
  3.  
  4. import me.ibecamealoaf.wizardry.Wand;
  5.  
  6. import org.bukkit.ChatColor;
  7. import org.bukkit.Effect;
  8. import org.bukkit.Location;
  9. import org.bukkit.Material;
  10. import org.bukkit.block.Block;
  11. import org.bukkit.entity.Entity;
  12. import org.bukkit.entity.Fireball;
  13. import org.bukkit.entity.Player;
  14. import org.bukkit.inventory.ItemStack;
  15. import org.bukkit.inventory.ShapedRecipe;
  16. import org.bukkit.inventory.meta.ItemMeta;
  17.  
  18. @SuppressWarnings("deprecation")
  19. public class FireballWand extends Wand {
  20.  
  21.     public String name() {
  22.         return "Fire Wand";
  23.     }
  24.  
  25.     public String[] description() {
  26.         return new String[] {"Shoots out a fiery blast of heat and fire,", "setting anything it hits on fire." };
  27.     }
  28.    
  29.     public ChatColor color() {
  30.         return ChatColor.RED;
  31.     }
  32.  
  33.     public Integer cooldown() {
  34.         return 35;
  35.     }
  36.  
  37.     public ItemStack item() {
  38.         ItemStack item = new ItemStack(Material.STICK);
  39.         ItemMeta im = item.getItemMeta();
  40.         im.setDisplayName(color() + name());
  41.         List<String> lore = new ArrayList<String>();
  42.         for(int i = 0; i < description().length; i++) lore.add(description()[i]);
  43.         im.setLore(lore);
  44.         item.setItemMeta(im);
  45.         return item;
  46.     }
  47.  
  48.     public void action(Player player) {
  49.         for(Block location : player.getLineOfSight(null, 100)) {
  50.             if(location != player.getEyeLocation().getBlock()) {
  51.                
  52.            
  53.             location.getWorld().playEffect(location.getLocation(), Effect.MOBSPAWNER_FLAMES, 1);
  54.             Location blockLocation = location.getLocation();
  55.             if(location.getType() != Material.AIR) break;
  56.             for(Entity entity : location.getWorld().getEntities()) {
  57.                 if(blockLocation.distance(entity.getLocation()) < 3.0 && entity != player) {
  58.                     entity.setFireTicks(100);
  59.                     }
  60.                 }
  61.             }
  62.         }
  63.         player.launchProjectile(Fireball.class);
  64.     }
  65.  
  66.     @Override
  67.     public ShapedRecipe recipe() {
  68.         ShapedRecipe fireWand = new ShapedRecipe(item());
  69.         fireWand.shape("DBD", "PSP", "RSR");
  70.         fireWand.setIngredient('D', Material.DIAMOND);
  71.         fireWand.setIngredient('S', Material.STICK);
  72.         fireWand.setIngredient('B', Material.SLIME_BALL);
  73.         fireWand.setIngredient('P', Material.BLAZE_POWDER);
  74.         fireWand.setIngredient('R', Material.REDSTONE);
  75.        
  76.         return fireWand;
  77.     }
  78.    
  79.    
  80.  
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement