EntityDamage events return 0 final dmg when player has absorption

Discussion in 'Spigot Discussion' started by Xeonmeister, Feb 21, 2020.

  1. So it drove me crazy until i finally found out about this. So long story short:
    Let's say your player has 20 health and 20 absorption (yellow hearts) and you deal 10 damage to him then after calculating the protection etc. the final damage will be let's say 6 hearts. Now this means that your player will have 20 health and 14 absoprtion. So he took 6 damage but the event returns 0 for the final damage. If the player has 20 health and 2 absorption and you deal 4 damage (so he will have 0 abs. and 18 hp) the event returns 2 for the final damage while it was actually 4.
    Is this a bug in the api or an intended feature?
    And if it's a feature then can someone tell me how to detect when a player blocks with a shield?
    (The method isBlocking() is not good bc the player can block with a shield and also take damage from an attack coming from behind)