mirror of
https://github.com/PaperMC/Paper.git
synced 2026-11-25 10:29:41 -05:00
SPIGOT-3813: Player.setHealth not reliable in conjunction with attribute API
This commit is contained in:
1 parent
49ecc7c7a2
commit
8bb4f6ccc1
2 files changed
+6
-3
No files matched your search
@@ -1382,9 +1382,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
injectScaledMaxHealth(set, true);
|
||||
|
||||
// SPIGOT-3813: Attributes before health
|
||||
if (getHandle().playerConnection != null) {
|
||||
getHandle().playerConnection.sendPacket(new PacketPlayOutUpdateAttributes(getHandle().getId(), set));
|
||||
sendHealthUpdate();
|
||||
}
|
||||
getHandle().getDataWatcher().set(EntityLiving.HEALTH, (float) getScaledHealth());
|
||||
sendHealthUpdate();
|
||||
getHandle().playerConnection.sendPacket(new PacketPlayOutUpdateAttributes(getHandle().getId(), set));
|
||||
|
||||
getHandle().maxHealthCache = getMaxHealth();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user