Paper/Spigot-Server-Patches/0047-Be-a-bit-more-informative-in-maxHealth-exception.patch
Aikar 57dd397155
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
b999860d SPIGOT-2304: Add LootGenerateEvent

CraftBukkit Changes:
77fd87e4 SPIGOT-2304: Implement LootGenerateEvent
a1a705ee SPIGOT-5566: Doused campfires & fires should call EntityChangeBlockEvent
41712edd SPIGOT-5707: PersistentDataHolder not Persistent on API dropped Item
2020-05-01 18:03:57 -04:00

26 lines
1.3 KiB
Diff

From 6b296e8747151670d7b51810ec33a18b7293cf42 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 6146db1841..966d23add1 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -106,7 +106,10 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public void setHealth(double health) {
health = (float) health;
if ((health < 0) || (health > getMaxHealth())) {
- throw new IllegalArgumentException("Health must be between 0 and " + getMaxHealth() + "(" + health + ")");
+ // Paper - Be more informative
+ throw new IllegalArgumentException("Health must be between 0 and " + getMaxHealth() + ", but was " + health
+ + ". (attribute base value: " + this.getHandle().getAttributeInstance(GenericAttributes.MAX_HEALTH).getBaseValue()
+ + (this instanceof CraftPlayer ? ", player: " + this.getName() + ')' : ')'));
}
getHandle().setHealth((float) health);
--
2.26.2