Solved Why does EntityDeathEvent call before EntityDamageByEntity event?

Discussion in 'Plugin Development' started by ImTheFool, Jan 13, 2013.

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

    ImTheFool

    Is there any way to make the damage event call before the death event? My plugin kinda relies on counting the damage everyone does to an entity, then handing out xp to whoever does damage to it when it dies. Currently, it doesn't grant xp to the last person to hit it.
     
  2. Offline

    Major_Derp

    Your code? And are you using getLastDamager ?
     
  3. Offline

    ImTheFool

    getLastDamager is only for the Death event. I'm using 2 different events. I would post my code for each, but they're both rather large.

    I already tried changing the priority on the Damage event to HIGHEST and the Death to NORMAL, and the Death event still happens first. :\


    Edit: I may know why it's happening. In my Damage event, I'm calling the LivingEntity.damage() event because I'm using a custom damage system. I am calling that before I add the attacker to the list, so it might be going through the Death event right as I call that, which would make it happen before adding to the list. I am going to check it out and edit my post again if I'm right.

    Edit2: Ah. That was it. Thanks for all the suggestions, though. :D
     
Thread Status:
Not open for further replies.

Share This Page