Bug with EntityDeathEvent?

Discussion in 'Spigot Plugin Development' started by Mykindos, Jun 28, 2016.

  1. So i've got a little piece of code to test this on my server (you dont need to see the rest), and I noticed the entitydeathevent is only being called when my player dies, (i am not using playerdeathevent).

    Code (Text):
        public void onDeath(EntityDeathEvent e){
    I tested it by killing a pig, a cow, everything. It only broadcasts 'test1' if a player dies.

    Any thoughts?
  2. Works perfectly for me:
    Code (Java):
    // Spigot 1.8.8
    private void someDeath(EntityDeathEvent event) {
      this.getLogger().info(event.getEntityType().toString() + " died.");
    Gets triggered within every LivingEntity, not only Players.

    Did you register your EventListener correctly? Where there other EventHandlers for the same Event within your plugin? What Server Version where you running?
  3. The javadoc says that it is thrown whenever a LivingEntity dies. I have no clue why it isn't working.. ;)
  4. I've been looking at this for a while, and I can't quite seem to figure out why it wouldn't work. Do you have any other events registered? Which version of Spigot are you using as your dependency, and which version is your server running on?

    That event should fire whenever any LivingEntity dies, so I'm curious as to why it isn't.
  5. Yeah usually i have no issues with such things, I might get around to restarting my computer in a bit, because last time something unusual like this happened, it was magically fixed.

    Extra notes: Latest spigot 1.10, event fires so it is registered correctly
  6. Update: Restarted PC, updated to latest spigot, tried moving listener to my main class, no success.

    I have submitted an issue report, hopefully something can be done soon.
  7. Have you heard anything more about this? All of my events are firing except for this one in the latest version of Spigot 1.10.2.
  8. I found that using setHealth(0) would call the death event for players, but it wouldnt call it for other entities.
  9. You can create a method and use that instead.