-
Bug
-
Resolution: Done
-
Minor
-
None
-
None
-
None
-
Linux (Ubuntu 20.04) & Java 11
-
This server is running CraftBukkit version 3028-Spigot-79d53c2-7eb3564 (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT)
-
Yes
When setting the max health of a player on PlayerDeathEvent or on EntityDamageEvent (when the damage would kill the player) and the player respawns afterwards it will show 20 max health for a brief moment before changing to the actual number that you set it to.
Example given below:
In the example I start with 54 max health (27 hearts) and reduce it by 6 (3 hearts) on death. On respawn the health is shown as 20 (10 hearts) for a brief moment which it then seems to update to the actual 48 (24 hearts) afterwards. Setting the health is done in sync.
I reduce the health by 6 with the following code:
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_MAX_HEALTH); if (attribute != null) { attribute.setBaseValue(attribute.getBaseValue() - 6); }