mirror of
https://hub.spigotmc.org/stash/scm/spigot/spigot.git
synced 2024-11-21 20:56:14 +00:00
31 lines
1.3 KiB
Diff
31 lines
1.3 KiB
Diff
From 20239c9301a43616f1232e3c79d1dd86a55ad6b9 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 a8d7d25a20..3510695b9a 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -2179,7 +2179,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
}
|
|
}
|
|
AttributeModifiable dummy = new AttributeModifiable(GenericAttributes.MAX_HEALTH, (attribute) -> { });
|
|
- dummy.setBaseValue(scaledHealth ? healthScale : getMaxHealth());
|
|
+ // 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" );
|
|
+ }
|
|
+ dummy.setBaseValue(healthMod);
|
|
+ // Spigot end
|
|
collection.add(dummy);
|
|
}
|
|
|
|
--
|
|
2.47.0
|
|
|