2016-12-10 23:50:31 +00:00
|
|
|
From fabb9366afe8e8558bb54cfc1076846a4332c612 Mon Sep 17 00:00:00 2001
|
2016-09-01 09:54:06 +00:00
|
|
|
From: kashike <kashike@vq.lc>
|
|
|
|
Date: Thu, 1 Sep 2016 09:51:31 +0000
|
2016-09-04 21:59:06 +00:00
|
|
|
Subject: [PATCH] Convert new health to a float during set
|
2016-09-01 09:54:06 +00:00
|
|
|
|
2016-09-04 21:59:06 +00:00
|
|
|
Convert the new health value to a float before doing any validation logic
|
2016-09-01 09:54:06 +00:00
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
2016-11-17 02:23:38 +00:00
|
|
|
index 0493c1b..13d480f 100644
|
2016-09-01 09:54:06 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
|
|
@@ -91,6 +91,7 @@ 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
|
|
|
|
--
|
2016-12-10 23:50:31 +00:00
|
|
|
2.9.3
|
2016-09-01 09:54:06 +00:00
|
|
|
|