geforkt von Mirrors/Paper
275173e538
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: 0c5d8709 SPIGOT-7400: Downgrade maven-resolver due to issues resolving certain depends 255c4fdb SPIGOT-7380: Add PlayerInteractEvent#getClickedPosition and ChiseledBookshelf#getSlot CraftBukkit Changes: b6b514b7e SPIGOT-7400: Downgrade maven-resolver due to issues resolving certain depends fcff84de9 SPIGOT-7399: Revert null check in CraftMetaItem#safelyAdd 44a4b5649 SPIGOT-7380: Add PlayerInteractEvent#getClickedPosition and ChiseledBookshelf#getSlot 676969d01 SPIGOT-7389: Handle setting null items in ChiseledBookshelf Inventory
38 Zeilen
1.9 KiB
Diff
38 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 fdd2539576df733424fcd68a8ff7612f5dc39db8..e41beff4c687917313f3a9c27b9079b979bd8c78 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -2320,9 +2320,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 {
|
|
@@ -2331,6 +2333,12 @@ 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;
|