9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-30 20:29:28 +00:00

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

This commit is contained in:
Hugo Planque
2022-07-13 01:11:38 +02:00
parent 261b9cc00c
commit 8b7b32906e

View File

@@ -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) {