2015-07-23 20:43:27 +00:00
|
|
|
From 4ec6e6d9f75473b9bc9eb14730e745576734f75d Mon Sep 17 00:00:00 2001
|
2014-07-21 20:46:54 +00:00
|
|
|
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-23 20:43:27 +00:00
|
|
|
index 5604506..95c5fb3 100644
|
2014-07-21 20:46:54 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2015-07-23 20:43:27 +00:00
|
|
|
@@ -1307,7 +1307,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
2014-07-21 20:46:54 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2014-11-28 01:17:45 +00: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)));
|
2014-07-21 20:46:54 +00:00
|
|
|
+ // 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 01:17:45 +00:00
|
|
|
+ collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged(null, "generic.maxHealth", healthMod, 0.0D, Float.MAX_VALUE)).a("Max Health").a(true)));
|
2014-07-21 20:46:54 +00:00
|
|
|
+ // Spigot end
|
|
|
|
}
|
|
|
|
|
2015-06-08 23:16:01 +00:00
|
|
|
@Override
|
2014-07-21 20:46:54 +00:00
|
|
|
--
|
2015-05-09 20:23:26 +00:00
|
|
|
2.1.4
|
2014-07-21 20:46:54 +00:00
|
|
|
|