mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-04 02:01:44 +01:00
SPIGOT-3813: Player.setHealth not reliable in conjunction with attribute API
This commit is contained in:
parent
49ecc7c7a2
commit
8bb4f6ccc1
2 changed files with 6 additions and 3 deletions
|
@ -257,7 +257,7 @@
|
|||
+ player.setRealHealth(f);
|
||||
+ }
|
||||
+
|
||||
+ this.datawatcher.set(EntityLiving.HEALTH, Float.valueOf(player.getScaledHealth()));
|
||||
+ player.updateScaledHealth();
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue