From ac750065e3625c32a07b3e1b27ab67b128cac54b Mon Sep 17 00:00:00 2001 From: Riley Park Date: Thu, 1 Sep 2016 09:54:06 +0000 Subject: [PATCH] Convert new health to a float during set Convert the new health value to a float before doing any validation logic --- ...ert-new-health-to-a-float-during-set.patch | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Spigot-Server-Patches/Convert-new-health-to-a-float-during-set.patch diff --git a/Spigot-Server-Patches/Convert-new-health-to-a-float-during-set.patch b/Spigot-Server-Patches/Convert-new-health-to-a-float-during-set.patch new file mode 100644 index 0000000000..7aa3d18b7c --- /dev/null +++ b/Spigot-Server-Patches/Convert-new-health-to-a-float-during-set.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Riley Park +Date: Thu, 1 Sep 2016 09:51:31 +0000 +Subject: [PATCH] Convert new health to a float during set Convert the new + health value to a float before doing any validation logic + + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { + } + + public void setHealth(double health) { ++ health = (float) health; // Paper - convert health to a float during set to avoid the below error + if ((health < 0) || (health > getMaxHealth())) { + // Paper - Be more informative + throw new IllegalArgumentException("Health must be between 0 and " + getMaxHealth() + ", but was " + health +-- \ No newline at end of file