Enchantment Showcase - Zag09
Willow Wisp
public class WispEnchant extends CustomEnchantment {
static final String[] WILLOWWISP_ITEMS = new String[] {
"wood_sword", "stone_sword", "iron_sword", "gold_sword", "diamond_sword"};
static final int COOLDOWN = 5000;
Hashtable<String, Long> timers = new Hashtable<String, Long>();
public WispEnchant() {
super("Willow Wisp", WILLOWWISP_ITEMS);
}
@Override
public void applyMiscEffect(Player player, int level, PlayerInteractEvent event) {
if (timers.get(player.getName()) == null) timers.put(player.getName(), 0l);
if (System.currentTimeMillis() - timers.get(player.getName()) < COOLDOWN) return;
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
event.getPlayer().launchProjectile(SmallFireball.class);
event.getPlayer().launchProjectile(SmallFireball.class);
event.getPlayer().launchProjectile(SmallFireball.class);
player.getWorld().playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1, 1);
timers.put(player.getName(), System.currentTimeMillis());
}
}
@Override
public int getEnchantmentLevel(int expLevel) {
return 1;
}
}
Posts Quoted:
Reply
Clear All Quotes
Comments