Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.List;
- import me.ibecamealoaf.wizardry.Wand;
- import org.bukkit.ChatColor;
- import org.bukkit.Effect;
- import org.bukkit.Location;
- import org.bukkit.Material;
- import org.bukkit.block.Block;
- import org.bukkit.entity.Entity;
- import org.bukkit.entity.Fireball;
- import org.bukkit.entity.Player;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.ShapedRecipe;
- import org.bukkit.inventory.meta.ItemMeta;
- @SuppressWarnings("deprecation")
- public class FireballWand extends Wand {
- public String name() {
- return "Fire Wand";
- }
- public String[] description() {
- return new String[] {"Shoots out a fiery blast of heat and fire,", "setting anything it hits on fire." };
- }
- public ChatColor color() {
- return ChatColor.RED;
- }
- public Integer cooldown() {
- return 35;
- }
- public ItemStack item() {
- ItemStack item = new ItemStack(Material.STICK);
- ItemMeta im = item.getItemMeta();
- im.setDisplayName(color() + name());
- List<String> lore = new ArrayList<String>();
- for(int i = 0; i < description().length; i++) lore.add(description()[i]);
- im.setLore(lore);
- item.setItemMeta(im);
- return item;
- }
- public void action(Player player) {
- for(Block location : player.getLineOfSight(null, 100)) {
- if(location != player.getEyeLocation().getBlock()) {
- location.getWorld().playEffect(location.getLocation(), Effect.MOBSPAWNER_FLAMES, 1);
- Location blockLocation = location.getLocation();
- if(location.getType() != Material.AIR) break;
- for(Entity entity : location.getWorld().getEntities()) {
- if(blockLocation.distance(entity.getLocation()) < 3.0 && entity != player) {
- entity.setFireTicks(100);
- }
- }
- }
- }
- player.launchProjectile(Fireball.class);
- }
- @Override
- public ShapedRecipe recipe() {
- ShapedRecipe fireWand = new ShapedRecipe(item());
- fireWand.shape("DBD", "PSP", "RSR");
- fireWand.setIngredient('D', Material.DIAMOND);
- fireWand.setIngredient('S', Material.STICK);
- fireWand.setIngredient('B', Material.SLIME_BALL);
- fireWand.setIngredient('P', Material.BLAZE_POWDER);
- fireWand.setIngredient('R', Material.REDSTONE);
- return fireWand;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement