aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/unapplied/server/0058-Be-a-bit-more-informative-in-maxHealth-exception.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/unapplied/server/0058-Be-a-bit-more-informative-in-maxHealth-exception.patch')
-rw-r--r--patches/unapplied/server/0058-Be-a-bit-more-informative-in-maxHealth-exception.patch24
1 files changed, 24 insertions, 0 deletions
diff --git a/patches/unapplied/server/0058-Be-a-bit-more-informative-in-maxHealth-exception.patch b/patches/unapplied/server/0058-Be-a-bit-more-informative-in-maxHealth-exception.patch
new file mode 100644
index 0000000000..dc513f3e96
--- /dev/null
+++ b/patches/unapplied/server/0058-Be-a-bit-more-informative-in-maxHealth-exception.patch
@@ -0,0 +1,24 @@
+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 8146e3df0fbcdb5f7e474167814bfbd569984fa0..ea7cbb5b5e7f140c06029ef05a01567d51b39f91 100644
+--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+@@ -108,7 +108,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
+ @Override
+ public void setHealth(double health) {
+ health = (float) health;
+- Preconditions.checkArgument(health >= 0 && health <= this.getMaxHealth(), "Health value (%s) must be between 0 and %s", health, this.getMaxHealth());
++ // Paper start - Be more informative
++ Preconditions.checkArgument(health >= 0 && health <= this.getMaxHealth(),
++ "Health value (%s) must be between 0 and %s. (attribute base value: %s%s)",
++ health, this.getMaxHealth(), this.getHandle().getAttribute(Attributes.MAX_HEALTH).getBaseValue(), this instanceof CraftPlayer ? ", player: " + this.getName() : ""
++ );
++ // Paper end
+
+ // during world generation, we don't want to run logic for dropping items and xp
+ if (this.getHandle().generation && health == 0) {