hotfix(Bukkit): fix death sync event when setting health of 0

feat/data-edit-commands
Hugo Planque 3 years ago
parent 261b9cc00c
commit 8b7b32906e

@ -82,7 +82,12 @@ public class BukkitPlayer extends OnlineUser {
if (statusDataFlags.contains(StatusDataFlag.SET_HEALTH)) {
final double currentHealth = player.getHealth();
if (statusData.health != currentHealth) {
player.setHealth(currentHealth > currentMaxHealth ? currentMaxHealth : statusData.health);
double healthToSet = currentHealth > currentMaxHealth ? currentMaxHealth : statusData.health;
if (healthToSet <= 0) {
Bukkit.getScheduler().runTask(BukkitHuskSync.getInstance(), () -> player.setHealth(healthToSet));
} else {
player.setHealth(healthToSet);
}
}
if (statusData.healthScale != 0d) {

Loading…
Cancel
Save