mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 20:46:59 +01:00
23 lines
1.4 KiB
Diff
23 lines
1.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: kashike <kashike@vq.lc>
|
|
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 f6b795ad57aec40231e262549839fa049458c634..1f67ac4484e3ee2e0a25030e0080a671f34e1a58 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
@@ -102,7 +102,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
|