9
0
mirror of https://github.com/Auxilor/EcoArmor.git synced 2025-12-28 03:19:25 +00:00

Fixed bonus-hearts not updating a players health

This commit is contained in:
Auxilor
2021-03-05 19:46:32 +00:00
parent 67d426a424
commit 92dad2e234

View File

@@ -23,6 +23,12 @@ public class BonusHearts extends Effect<Integer> {
return;
}
if (player.getHealth() >= maxHealth.getValue()) {
this.getPlugin().getScheduler().runLater(() -> {
player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
}, 1);
}
AttributeModifier modifier = new AttributeModifier(this.getUuid(), "bonus-hearts", bonus, AttributeModifier.Operation.ADD_NUMBER);
if (maxHealth.getModifiers().stream().noneMatch(attributeModifier -> attributeModifier.getUniqueId().equals(modifier.getUniqueId()))) {
maxHealth.addModifier(modifier);