Tweak logic for determining if a player is dead, fix issues with <1HP players being detected dead

feat/data-edit-commands
William 2 years ago
parent dd39482ed1
commit bac760165e

@ -618,7 +618,7 @@ public class BukkitPlayer extends OnlineUser {
@Override @Override
public boolean isDead() { public boolean isDead() {
return player.isDead() || player.getHealth() <= 0; return player.getHealth() <= 0;
} }
@Override @Override

@ -321,6 +321,7 @@ public abstract class OnlineUser extends User {
if (!isOffline()) { if (!isOffline()) {
if (settings.getSynchronizationFeature(Settings.SynchronizationFeature.INVENTORIES)) { if (settings.getSynchronizationFeature(Settings.SynchronizationFeature.INVENTORIES)) {
if (isDead() && settings.saveDeadPlayerInventories) { 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()))); add(CompletableFuture.runAsync(() -> builder.setInventory(ItemData.empty())));
} else { } else {
add(getInventory().thenAccept(builder::setInventory)); add(getInventory().thenAccept(builder::setInventory));

Loading…
Cancel
Save