Damage after EntityDamageByEntityEvent

Discussion in 'Plugin Development' started by Acer_Mortem, Apr 1, 2014.

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

    Acer_Mortem

    During the EntityDamageEvent, I check the entities health minus the damage taken, and this returns a number.

    However, if I run a scheduler and check the entities health 1 tick after the damage has been taken, the entities health does not return the number from before, and is instead lower than the number I checked first.

    My question is, how can I prevent this fluctuation in damage from occuring, and instead make sure the entities damage is the same, while still having damage occuring?

    I cannot set the damage in the event to zero and just manually set the entities health, as this messes with how Bukkit checks who was the last damager, who's the killer, etc.

    Any ideas?
     
  2. Offline

    2MBKindiegames

    I believe that in the EntityDamageEvent the returned health is already minus the damage!
     
  3. 2MBKindiegames I think that's the point he's making - if he checks it right away, it's the health before it's been taken away. But if he checks it a tick later, the damage has been dealt - I think he wants the health before damage, but a tick later.

    If that's the case Acer_Mortem, can't you just store the health before the scheduler and use it then?
     
  4. Offline

    2MBKindiegames

    AdamQpzm
    Mmmh, He says he checks the entitys health (let's say 10) minus the damage dealt (eg 5) so it returns 5. A tick later, the getHealth should also return 5 but it gives something lower
     
    AdamQpzm likes this.
  5. Offline

    Acer_Mortem

    2MBKindiegames

    That's exactly what's happening, except actually, their health is a little bit higher. Anyway, I'm trying to find a way around this little problem.
     
  6. Offline

    Juicyzbox

    For your event handler use priority = EventHandler.MONITER

    Something else seems to be affecting your damage. Another plugin or something else on a higher priority can still change it that you are not accounting for while if you use monitor that is the final damage that the event caused.

    Aver what you said about setting all the last damages is possible, you can do it yourself.
     
  7. Offline

    Acer_Mortem

    Juicyzbox

    I'll mess around with setting the last damage and whatnot to see if I can fix it ;3
     
Thread Status:
Not open for further replies.

Share This Page