Solved nothing happens on event

Discussion in 'Spigot Plugin Development' started by Jaffaaaa, Aug 10, 2018.

Thread Status:
Not open for further replies.
  1. When anything dies the message "death seen" isn't triggered. I've registered it in main.

    Code (Java):
    package xyz.theducc.play.wither;

    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.entity.EntityType;
    import org.bukkit.entity.Player;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.EntityDeathEvent;

    public class witherBossDeath implements Listener {

        public void onWitherDeath(EntityDeathEvent e) {
            Bukkit.broadcastMessage("death seen");
            if (e.getEntity().getType().equals(EntityType.WITHER)) {
               
                Player witherKiller = e.getEntity().getKiller();
               
                Bukkit.broadcastMessage(ChatColor.YELLOW + "--------------------------------------------");
                Bukkit.broadcastMessage(ChatColor.GREEN + "" + ChatColor.BOLD + ">> " + ChatColor.RED + "" + ChatColor.BOLD +"Boss Xela"
                + ChatColor.GOLD + " was defeated by " + ChatColor.GREEN + "" + ChatColor.BOLD + witherKiller.getName() + ChatColor.GOLD + "!");
                Bukkit.broadcastMessage(ChatColor.RED + "PvP in the PvPArena will be enabled in 60 seconds!");
                Bukkit.broadcastMessage(ChatColor.YELLOW + "--------------------------------------------");
            }
        }
    }
     
     
  2. How dare you hold a method party without inviting @EventHandler!
     
    • Funny Funny x 2
    • Creative Creative x 1
  3. You're missing the EventHandler annotation right before your method. Just like @Chalkie said in a funny way ^_^.
     
    • Informative Informative x 1
Thread Status:
Not open for further replies.