mirror of
https://github.com/WiIIiam278/HuskSync.git
synced 2025-12-26 10:09:10 +00:00
Fix incompatibility with custom health scalars, close #25
This commit is contained in:
@@ -464,12 +464,13 @@ public class PlayerSetter {
|
||||
*/
|
||||
private static void setPlayerHealth(Player player, double health, double maxHealth, double healthScale) {
|
||||
// Set max health
|
||||
if (maxHealth != 0.0D) {
|
||||
if (maxHealth != 0D) {
|
||||
Objects.requireNonNull(player.getAttribute(Attribute.GENERIC_MAX_HEALTH)).setBaseValue(maxHealth);
|
||||
}
|
||||
|
||||
// Set health
|
||||
player.setHealth(player.getHealth() > maxHealth ? maxHealth : health);
|
||||
double currentHealth = player.getHealth();
|
||||
if (health != currentHealth) player.setHealth(currentHealth > maxHealth ? maxHealth : health);
|
||||
|
||||
// Set health scaling if needed
|
||||
if (healthScale != 0D) {
|
||||
|
||||
Reference in New Issue
Block a user