From 11dcf97f9aa576600e148f0004de14f925a99174 Mon Sep 17 00:00:00 2001 From: Aria Date: Tue, 15 Oct 2019 12:06:00 +0200 Subject: [PATCH] Added an extra death check to health regen. --- src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index 05e6a8ae..12688e20 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -382,7 +382,8 @@ public class PlayerData { } public void heal(double heal) { - getPlayer().setHealth(Math.min(player.getHealth() + heal, player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue())); + double healAmount = Math.min(player.getHealth() + heal, player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()); + if(healAmount > 0) getPlayer().setHealth(healAmount); } public void addFriend(UUID uuid) {