From 634ad7d00e09a48c9bf53a648249727a48dc4060 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sat, 28 Jan 2017 11:41:09 +1100 Subject: [PATCH] SPIGOT-3040: Round health to float for validation By: md_5 --- .../java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 4641e3d529..58fbed1d30 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -91,8 +91,9 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } public void setHealth(double health) { + health = (float) health; if ((health < 0) || (health > getMaxHealth())) { - throw new IllegalArgumentException("Health must be between 0 and " + getMaxHealth()); + throw new IllegalArgumentException("Health must be between 0 and " + getMaxHealth() + "(" + health + ")"); } if (health == 0) {