EntityDamageByEntityEvent isDead problem

Discussion in 'Plugin Development' started by NotScammer, Jul 11, 2020.

  1. Offline

    NotScammer

    Code:
        @EventHandler
        public void onDamage(EntityDamageByEntityEvent event) {
                Player player = (Player)event.getDamager();
                Entity e = event.getEntity();
                if(e.isDead()) {
                System.out.println(player.getName() +" Killed : "+ event.getEntityType().toString() + " Special name : " + event.getEntity().getCustomName() + "  at : " + player.getLocation().getX() + " " + player.getLocation().getY() + " " + player.getLocation().getZ());
                }
               
                }
            }

    Hey, this is my code ^^^ and when i check the entity is dead it doesnt work can anyone help me
     
  2. Online

    timtower Moderator Moderator

    @NotScammer The event can still be cancelled. So the entity is not dead yet.
    Do watch out with that Player cast btw, will throw errors
     

Share This Page