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