From 817f10acffa09d8114207e5b109ff12b26ecdda1 Mon Sep 17 00:00:00 2001 From: Blank038 Date: Sat, 2 Nov 2024 22:03:05 +0800 Subject: [PATCH] fix: Fixes potential health bug --- .../esync/internal/module/entity/PlayerStatusEntity.kt | 2 +- .../esync/internal/module/impl/PlayerStatusModuleImpl.kt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/bukkit/src/main/kotlin/com/aiyostudio/esync/internal/module/entity/PlayerStatusEntity.kt b/bukkit/src/main/kotlin/com/aiyostudio/esync/internal/module/entity/PlayerStatusEntity.kt index 81f39ac..d95e969 100644 --- a/bukkit/src/main/kotlin/com/aiyostudio/esync/internal/module/entity/PlayerStatusEntity.kt +++ b/bukkit/src/main/kotlin/com/aiyostudio/esync/internal/module/entity/PlayerStatusEntity.kt @@ -16,7 +16,7 @@ class PlayerStatusEntity : IEntity { try { if (player is Player) { player.getAttribute(Attribute.GENERIC_MAX_HEALTH).baseValue = maxHealth - player.health = health + player.health = Math.min(health, maxHealth) potions.forEach { player.addPotionEffect(it) } return true } diff --git a/bukkit/src/main/kotlin/com/aiyostudio/esync/internal/module/impl/PlayerStatusModuleImpl.kt b/bukkit/src/main/kotlin/com/aiyostudio/esync/internal/module/impl/PlayerStatusModuleImpl.kt index ed147ab..a71e6cf 100644 --- a/bukkit/src/main/kotlin/com/aiyostudio/esync/internal/module/impl/PlayerStatusModuleImpl.kt +++ b/bukkit/src/main/kotlin/com/aiyostudio/esync/internal/module/impl/PlayerStatusModuleImpl.kt @@ -7,7 +7,6 @@ import org.bukkit.Bukkit import org.bukkit.attribute.Attribute import org.bukkit.configuration.ConfigurationSection import org.bukkit.configuration.file.YamlConfiguration -import org.bukkit.configuration.serialization.ConfigurationSerialization import org.bukkit.potion.PotionEffect import java.util.*