Damage listener problem

Discussion in 'Plugin Development' started by PluginMan100, May 18, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    PluginMan100

    Hello. I have problem with damage listener (just it not works):
    Code:java
    1. public void onEnable() {
    2. Bukkit.getServer().getPluginManager().registerEvents(this, this);
    3. }
    4. public void onEntityDamage(EntityDamageByEntityEvent e) {
    5.  
    6. if (e.getDamager() instanceof WitherSkull) {
    7. Player ep = (Player) e;
    8. ep.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 2, 1));
    9. }
    10.  
    11. if (e instanceof Wither) {
    12. if (((Wither) e).getHealth() <= 75) {
    13. ((Wither) e).getWorld().spawnCreature(((Wither) e).getLocation(), CreatureType.BLAZE);
    14. if(e.getDamager() instanceof Player) {
    15. Player epp = (Player) e.getDamager();
    16. epp.sendMessage(ChatColor.RED+"[Wither]"+ChatColor.GOLD+" Kill him, my soldiers!");
    17. }
    18. }
    19. }
    20. }


    What's wrong?
     
  2. Offline

    Gater12

    PluginMan100
    You forgot your EventHandler annotation above your event method.
     
Thread Status:
Not open for further replies.

Share This Page