From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: kashike 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 68c2825c2d43b3c949cc4b08035b0f5d277f34f2..844a97b0eb396835ec72b4d14c9362a2ea2a8709 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -102,7 +102,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) {