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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user