Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-17 13:30:06 +01:00
19972e09b8
5a0150f586ed3eb15fe6f1f596d1a5a7d806f0f9 Fix ITEM_BREAK e6a3911057bd94d8bd7021cbb4923fb84fb106d1 Upstream merge d1cdcf8d4c3639f956474f02ed662517cffbe23e Remove old patch 068df64aeee368377e1673667bffc7a6dcf90554 Rebuild all patches
31 Zeilen
1.4 KiB
Diff
31 Zeilen
1.4 KiB
Diff
From 9be921dd637edaadca7d6cc409999a087a3cdf7a Mon Sep 17 00:00:00 2001
|
|
From: Thinkofdeath <thinkofdeath@spigotmc.org>
|
|
Date: Sat, 19 Jul 2014 19:54:41 +0100
|
|
Subject: [PATCH] Prevent a crash involving attributes
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
index 573e401..ae59896 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -1309,7 +1309,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
break;
|
|
}
|
|
}
|
|
- collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged(null, "generic.maxHealth", scaledHealth ? healthScale : getMaxHealth(), 0.0D, Float.MAX_VALUE)).a("Max Health").a(true)));
|
|
+ // Spigot start
|
|
+ double healthMod = scaledHealth ? healthScale : getMaxHealth();
|
|
+ if ( healthMod >= Float.MAX_VALUE || healthMod <= 0 )
|
|
+ {
|
|
+ healthMod = 20; // Reset health
|
|
+ getServer().getLogger().warning( getName() + " tried to crash the server with a large health attribute" );
|
|
+ }
|
|
+ collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged(null, "generic.maxHealth", healthMod, 0.0D, Float.MAX_VALUE)).a("Max Health").a(true)));
|
|
+ // Spigot end
|
|
}
|
|
|
|
// Spigot start
|
|
--
|
|
2.1.0
|
|
|