From 4e1793f363fad0ecb8c519526f1b93d8fd53377d Mon Sep 17 00:00:00 2001 From: feildmaster Date: Sun, 23 Dec 2012 07:16:59 -0600 Subject: [PATCH] Report valid health when getting Entity health. Fixes BUKKIT-3210 --- .../java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index ee41c37b08..f2f43466e4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -59,7 +59,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } public int getHealth() { - return getHandle().getHealth(); + return Math.min(Math.max(0, getHandle().getHealth()), getMaxHealth()); } public void setHealth(int health) {