onEntityDamage issues

Discussion in 'Plugin Development' started by luciddream, Feb 14, 2011.

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


    Does anyone have any clue how to filter out onEntityDamage events if they aren't actually doing any damage? If I attack someone twice quickly enough only one of the hits will do damage but both of them will trigger. I tried doing if(event.getDamage() > 0) but no luck, it was getting damage for both hits even when the second one didn't actually hurt the target. I could do it if I could get the entity's no damage ticks, but it doesn't look like you can with bukkit.
  2. Offline


    It's probably just server lag.
  3. Offline

    Edward Hand

    You can do it by interfacing with CraftBukkit and the server base classes:
    CraftLivingEntity cEntity = (CraftLivingEntity)event.getEntity()
    int damageTicks cEntity.getHandle().hurtTicks
  4. Offline


    This should work great, thanks =D

    edit: It does! Awesome!
Thread Status:
Not open for further replies.

Share This Page