mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 03:43:40 +01:00
Fix scaling for player health. Fixes BUKKIT-4431
By: Wesley Wolfe <weswolf@aol.com>
This commit is contained in:
parent
92b386ce0b
commit
48a3e72018
1 changed files with 13 additions and 0 deletions
|
@ -61,6 +61,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||
private final Set<String> channels = new HashSet<String>();
|
||||
private final Map<String, Player> hiddenPlayers = new MapMaker().softValues().makeMap();
|
||||
private int hash = 0;
|
||||
private boolean scaledHealth;
|
||||
|
||||
public CraftPlayer(CraftServer server, EntityPlayer entity) {
|
||||
super(server, entity);
|
||||
|
@ -997,4 +998,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||
|
||||
this.server.getScoreboardManager().setPlayerBoard(this, scoreboard);
|
||||
}
|
||||
|
||||
public float getScaledHealth() {
|
||||
return (float) (this.scaledHealth ? getHealth() / getMaxHealth() * 20.0D : getHealth());
|
||||
}
|
||||
|
||||
public void setScaleHealth(boolean scale) {
|
||||
this.scaledHealth = scale;
|
||||
}
|
||||
|
||||
public boolean isScaledHealth() {
|
||||
return this.scaledHealth;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue