Solved EntityDamageByEntityEvent

Discussion in 'Plugin Development' started by Tdarnell, Jun 8, 2013.

Thread Status:
Not open for further replies.
  1. My problem is that my code is doing nothing once enabled, and I'm fairly sure its all right, but just incase I missed something stupid I'll post it here.


    The main is in the right place, and all of that code is in the main class. nothing is happening when I damage a wither though, not even my debug messages send. any help is appreciated. :)

    Edit: Image didn't work :p

        public void onEntityDamage(EntityDamageByEntityEvent event) {
            if (!(event.getDamager() instanceof Player)) return;
            Player p = (Player)event.getDamager();
            Entity entity = event.getEntity();
            if (!(entity instanceof LivingEntity)) return;
            if ((entity instanceof Wither)){
                if(event.getDamager() instanceof Player){
                    int health = ((Damageable) entity).getHealth();
                    if (health > 0){
                        //Entity health = entity.getHealth();
  2. Offline


    Did you register your events?
  3. I'm pretty sure I did, I'll double check, but I usually copy and paste my onEnable and other common bits from older projects, so I imagine I did :L
    I'll make sure anyway.

    Edit: Ok I'll go shoot myself, I forgot to register my events -.- Thanks for pointing out my dumbness xD
Thread Status:
Not open for further replies.

Share This Page