aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0050-Be-a-bit-more-informative-in-maxHealth-exception.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0050-Be-a-bit-more-informative-in-maxHealth-exception.patch')
-rw-r--r--patches/server/0050-Be-a-bit-more-informative-in-maxHealth-exception.patch22
1 files changed, 22 insertions, 0 deletions
diff --git a/patches/server/0050-Be-a-bit-more-informative-in-maxHealth-exception.patch b/patches/server/0050-Be-a-bit-more-informative-in-maxHealth-exception.patch
new file mode 100644
index 0000000000..edd16859a7
--- /dev/null
+++ b/patches/server/0050-Be-a-bit-more-informative-in-maxHealth-exception.patch
@@ -0,0 +1,22 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: kashike <[email protected]>
+Date: Thu, 3 Mar 2016 02:18:39 -0600
+Subject: [PATCH] Be a bit more informative in maxHealth exception
+
+
+diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+index a6192a7edd94e63c568ca8196e0ed9fa993da6bb..1d3cd79634366718cd354cd2f55c6fc974ad3525 100644
+--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+@@ -99,7 +99,10 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
+ public void setHealth(double health) {
+ health = (float) health;
+ if ((health < 0) || (health > this.getMaxHealth())) {
+- throw new IllegalArgumentException("Health must be between 0 and " + this.getMaxHealth() + "(" + health + ")");
++ // Paper - Be more informative
++ throw new IllegalArgumentException("Health must be between 0 and " + getMaxHealth() + ", but was " + health
++ + ". (attribute base value: " + this.getHandle().getAttribute(Attributes.MAX_HEALTH).getBaseValue()
++ + (this instanceof CraftPlayer ? ", player: " + this.getName() + ')' : ')'));
+ }
+
+ // during world generation, we don't want to run logic for dropping items and xp