mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-13 19:28:03 +01:00
Prevent a crash involving attributes
By: Thinkofdeath <thinkofdeath@spigotmc.org>
This commit is contained in:
parent
6578ff97bb
commit
0166f71409
1 changed files with 9 additions and 1 deletions
|
@ -2160,7 +2160,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||
}
|
||||
}
|
||||
AttributeInstance dummy = new AttributeInstance(Attributes.MAX_HEALTH, (attribute) -> { });
|
||||
dummy.setBaseValue(this.scaledHealth ? this.healthScale : this.getMaxHealth());
|
||||
// Spigot start
|
||||
double healthMod = this.scaledHealth ? this.healthScale : this.getMaxHealth();
|
||||
if ( healthMod >= Float.MAX_VALUE || healthMod <= 0 )
|
||||
{
|
||||
healthMod = 20; // Reset health
|
||||
this.getServer().getLogger().warning( this.getName() + " tried to crash the server with a large health attribute" );
|
||||
}
|
||||
dummy.setBaseValue(healthMod);
|
||||
// Spigot end
|
||||
collection.add(dummy);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue