Paper/CraftBukkit-Patches/0132-Prevent-a-crash-involving-attributes.patch

31 Zeilen
1.4 KiB
Diff

2015-07-10 14:33:16 +02:00
From 66f142c97e690ec9d271cc9dcdf6dae0ddf12262 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
2015-07-10 14:33:16 +02:00
index 7460af5..33547eb 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
2015-07-10 14:33:16 +02:00
@@ -1313,7 +1313,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
break;
}
}
2014-11-28 02:17:45 +01:00
- 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" );
+ }
2014-11-28 02:17:45 +01:00
+ collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged(null, "generic.maxHealth", healthMod, 0.0D, Float.MAX_VALUE)).a("Max Health").a(true)));
+ // Spigot end
}
2015-06-09 01:16:01 +02:00
@Override
--
2015-05-09 22:23:26 +02:00
2.1.4