summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfeildmaster <admin@feildmaster.com>2012-12-23 07:16:59 -0600
committerfeildmaster <admin@feildmaster.com>2012-12-23 07:29:05 -0600
commit4e1793f363fad0ecb8c519526f1b93d8fd53377d (patch)
tree3271eaeae1f5da771a65adfb8972f4e39060e740
parented6aab8200f0f28219ea01306a6f8b62f66bcbb2 (diff)
downloadcraftbukkit-4e1793f363fad0ecb8c519526f1b93d8fd53377d.tar
craftbukkit-4e1793f363fad0ecb8c519526f1b93d8fd53377d.tar.gz
craftbukkit-4e1793f363fad0ecb8c519526f1b93d8fd53377d.tar.lz
craftbukkit-4e1793f363fad0ecb8c519526f1b93d8fd53377d.tar.xz
craftbukkit-4e1793f363fad0ecb8c519526f1b93d8fd53377d.zip
Report valid health when getting Entity health. Fixes BUKKIT-3210
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index ee41c37b..f2f43466 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) {