Fix bug with overscaled health

This commit is contained in:
Daniel Saukel 2016-11-23 13:14:00 +01:00
parent 191f47b092
commit 9c2a45d814
3 changed files with 14 additions and 14 deletions

View File

@ -58,7 +58,7 @@ public class PlayerData extends BRConfig {
private ItemStack oldOffHand;
private int oldLvl;
private float oldExp;
private double oldHealthScale;
private double oldMaxHealth;
private double oldHealth;
private int oldFoodLevel;
private int oldFireTicks;
@ -176,18 +176,18 @@ public class PlayerData extends BRConfig {
}
/**
* @return the old health scale
* @return the old max health
*/
public double getOldHealthScale() {
return oldHealthScale;
public double getOldMaxHealth() {
return oldMaxHealth;
}
/**
* @param healthScale
* the healthScale to set
* @param maxHealth
* the maximum health to set
*/
public void setOldHealthScale(double healthScale) {
oldHealthScale = healthScale;
public void setOldMaxHealth(double maxHealth) {
oldMaxHealth = maxHealth;
}
/**
@ -342,7 +342,7 @@ public class PlayerData extends BRConfig {
oldLvl = config.getInt(PREFIX_STATE_PERSISTENCE + "oldLvl");
oldExp = config.getInt(PREFIX_STATE_PERSISTENCE + "oldExp");
oldHealthScale = config.getDouble(PREFIX_STATE_PERSISTENCE + "oldHealthScale");
oldMaxHealth = config.getDouble(PREFIX_STATE_PERSISTENCE + "oldMaxHealth");
oldHealth = config.getDouble(PREFIX_STATE_PERSISTENCE + "oldHealth");
oldFoodLevel = config.getInt(PREFIX_STATE_PERSISTENCE + "oldFoodLevel");
oldFireTicks = config.getInt(PREFIX_STATE_PERSISTENCE + "oldFireTicks");
@ -376,7 +376,7 @@ public class PlayerData extends BRConfig {
oldGameMode = player.getGameMode();
oldFireTicks = player.getFireTicks();
oldFoodLevel = player.getFoodLevel();
oldHealthScale = player.getHealthScale();
oldMaxHealth = player.getMaxHealth();
oldHealth = player.getHealth();
oldExp = player.getExp();
oldLvl = player.getLevel();
@ -391,7 +391,7 @@ public class PlayerData extends BRConfig {
config.set(PREFIX_STATE_PERSISTENCE + "oldGameMode", oldGameMode.toString());
config.set(PREFIX_STATE_PERSISTENCE + "oldFireTicks", oldFireTicks);
config.set(PREFIX_STATE_PERSISTENCE + "oldFoodLevel", oldFoodLevel);
config.set(PREFIX_STATE_PERSISTENCE + "oldHealthScale", oldHealthScale);
config.set(PREFIX_STATE_PERSISTENCE + "oldMaxHealth", oldMaxHealth);
config.set(PREFIX_STATE_PERSISTENCE + "oldHealth", oldHealth);
config.set(PREFIX_STATE_PERSISTENCE + "oldExp", oldExp);
config.set(PREFIX_STATE_PERSISTENCE + "oldLvl", oldLvl);
@ -411,7 +411,7 @@ public class PlayerData extends BRConfig {
oldGameMode = null;
oldFireTicks = 0;
oldFoodLevel = 0;
oldHealthScale = 0;
oldMaxHealth = 20;
oldHealth = 0;
oldExp = 0;
oldLvl = 0;

View File

@ -281,7 +281,7 @@ public class DGlobalPlayer {
}
player.setLevel(data.getOldLevel());
player.setExp(data.getOldExp());
player.setHealthScale(data.getOldHealthScale());
player.setMaxHealth(data.getOldMaxHealth());
player.setHealth(data.getOldHealth());
player.setFoodLevel(data.getOldFoodLevel());
player.setGameMode(data.getOldGameMode());

View File

@ -83,7 +83,7 @@ public abstract class DInstancePlayer extends DGlobalPlayer {
player.getInventory().setArmorContents(null);
player.setTotalExperience(0);
player.setLevel(0);
player.setHealthScale(20);
player.setMaxHealth(20);
player.setHealth(20);
player.setFoodLevel(20);
for (PotionEffect effect : player.getActivePotionEffects()) {