Fixed prosperity health bug

This commit is contained in:
Auxilor 2022-06-05 10:34:20 +01:00
parent 9ad527ae16
commit 9aab8ff64f

View File

@ -41,9 +41,10 @@ public class Prosperity extends EcoEnchant {
points = 0; points = 0;
} }
if (player.getHealth() >= inst.getValue() && player.getHealth() >= 20) { if (player.getHealth() >= inst.getValue() && player.getHealth() >= 20) {
this.getPlugin().getScheduler().runLater(() -> { this.getPlugin().getScheduler().runLater(() -> {
player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()); player.setHealth(Math.min(player.getHealth(), player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()));
}, 1); }, 1);
} }