geforkt von Mirrors/Paper
ef0e5a642d
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 9ae3f10f SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API 48c0c547 PR-786: Add methods to get sounds from entities CraftBukkit Changes: 5cc9c022a SPIGOT-7152: Handle hand item changing during air interact event 4ffa1acf6 SPIGOT-7154: Players get kicked when interacting with a conversation 4daa21123 SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API e5d6a9bbf PR-1100: Add methods to get sounds from entities b7e9f1c8b SPIGOT-7146: Reduce use of Material switch in ItemMeta Spigot Changes: 4c157bb4 Rebuild patches
40 Zeilen
1.9 KiB
Diff
40 Zeilen
1.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: SamB440 <sam@islandearth.net>
|
|
Date: Wed, 17 Nov 2021 12:31:42 +0000
|
|
Subject: [PATCH] Add player health update API
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
index 5cdb599c6e460672ed0fe15d5c2a9d60ad22c2e3..8882651847fc9a8d2e4222f10eb389b553da48ca 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -2142,9 +2142,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
this.getHandle().maxHealthCache = getMaxHealth();
|
|
}
|
|
|
|
- public void sendHealthUpdate() {
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public void sendHealthUpdate(final double health, final int foodLevel, final float saturationLevel) {
|
|
// Paper start - cancellable death event
|
|
- ClientboundSetHealthPacket packet = new ClientboundSetHealthPacket(this.getScaledHealth(), this.getHandle().getFoodData().getFoodLevel(), this.getHandle().getFoodData().getSaturationLevel());
|
|
+ ClientboundSetHealthPacket packet = new ClientboundSetHealthPacket((float) health, foodLevel, saturationLevel);
|
|
if (this.getHandle().queueHealthUpdatePacket) {
|
|
this.getHandle().queuedHealthUpdatePacket = packet;
|
|
} else {
|
|
@@ -2152,7 +2154,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
}
|
|
// Paper end
|
|
}
|
|
-
|
|
+
|
|
+ @Override
|
|
+ public void sendHealthUpdate() {
|
|
+ this.sendHealthUpdate(this.getScaledHealth(), this.getHandle().getFoodData().getFoodLevel(), this.getHandle().getFoodData().getSaturationLevel());
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
public void injectScaledMaxHealth(Collection<AttributeInstance> collection, boolean force) {
|
|
if (!this.scaledHealth && !force) {
|
|
return;
|