mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 15:47:44 +01:00
30 lines
1.4 KiB
Diff
30 lines
1.4 KiB
Diff
From af80849ef89df89030f083a5cc14ae2faa736bcb 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 625e6f3..1127461 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -1291,7 +1291,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
break;
|
|
}
|
|
}
|
|
- collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged("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("generic.maxHealth", healthMod, 0.0D, Float.MAX_VALUE)).a("Max Health").a(true)));
|
|
+ // Spigot end
|
|
}
|
|
|
|
// Spigot start
|
|
--
|
|
1.9.1
|
|
|