Fix scaling for player health. Fixes BUKKIT-4431

By: Wesley Wolfe <weswolf@aol.com>
This commit is contained in:
CraftBukkit/Spigot 2013-07-02 23:08:55 -05:00
parent 92b386ce0b
commit 48a3e72018

View file

@ -61,6 +61,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
private final Set<String> channels = new HashSet<String>(); private final Set<String> channels = new HashSet<String>();
private final Map<String, Player> hiddenPlayers = new MapMaker().softValues().makeMap(); private final Map<String, Player> hiddenPlayers = new MapMaker().softValues().makeMap();
private int hash = 0; private int hash = 0;
private boolean scaledHealth;
public CraftPlayer(CraftServer server, EntityPlayer entity) { public CraftPlayer(CraftServer server, EntityPlayer entity) {
super(server, entity); super(server, entity);
@ -997,4 +998,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.server.getScoreboardManager().setPlayerBoard(this, scoreboard); 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;
}
} }