From bac760165e693650335e82993bc59584e50b7751 Mon Sep 17 00:00:00 2001 From: William Date: Sun, 6 Nov 2022 22:31:33 +0000 Subject: [PATCH] Tweak logic for determining if a player is dead, fix issues with <1HP players being detected dead --- .../main/java/net/william278/husksync/player/BukkitPlayer.java | 2 +- .../main/java/net/william278/husksync/player/OnlineUser.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bukkit/src/main/java/net/william278/husksync/player/BukkitPlayer.java b/bukkit/src/main/java/net/william278/husksync/player/BukkitPlayer.java index dd0bc1bb..80867d3a 100644 --- a/bukkit/src/main/java/net/william278/husksync/player/BukkitPlayer.java +++ b/bukkit/src/main/java/net/william278/husksync/player/BukkitPlayer.java @@ -618,7 +618,7 @@ public class BukkitPlayer extends OnlineUser { @Override public boolean isDead() { - return player.isDead() || player.getHealth() <= 0; + return player.getHealth() <= 0; } @Override diff --git a/common/src/main/java/net/william278/husksync/player/OnlineUser.java b/common/src/main/java/net/william278/husksync/player/OnlineUser.java index 6ad067e5..49387e92 100644 --- a/common/src/main/java/net/william278/husksync/player/OnlineUser.java +++ b/common/src/main/java/net/william278/husksync/player/OnlineUser.java @@ -321,6 +321,7 @@ public abstract class OnlineUser extends User { if (!isOffline()) { if (settings.getSynchronizationFeature(Settings.SynchronizationFeature.INVENTORIES)) { if (isDead() && settings.saveDeadPlayerInventories) { + logger.debug("Player " + username + " is dead, so their inventory will be set to empty."); add(CompletableFuture.runAsync(() -> builder.setInventory(ItemData.empty()))); } else { add(getInventory().thenAccept(builder::setInventory));