Use double to store health

This commit is contained in:
Daniel Saukel 2016-05-22 20:30:06 +02:00
parent f266f00412
commit 6b70e71abb
3 changed files with 8 additions and 10 deletions

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.dre2n</groupId>
<artifactId>dungeonsxl</artifactId>
<version>0.11.3</version>
<version>0.11.4</version>
<packaging>jar</packaging>
<name>DungeonsXL</name>
<url>https://dre2n.github.io</url>

View File

@ -99,15 +99,13 @@ public class DGamePlayer extends DGlobalPlayer {
this.world = world;
double health = player.getHealth();
if (!Version.andHigher(Version.MC1_9).contains(CompatibilityHandler.getInstance().getVersion())) {
savePlayer = new DSavePlayer(player.getName(), player.getUniqueId(), player.getLocation(), player.getInventory().getContents(), player.getInventory().getArmorContents(), null, player.getLevel(),
player.getTotalExperience(), (int) health, player.getFoodLevel(), player.getFireTicks(), player.getGameMode(), player.getActivePotionEffects());
player.getTotalExperience(), player.getHealth(), player.getFoodLevel(), player.getFireTicks(), player.getGameMode(), player.getActivePotionEffects());
} else {
savePlayer = new DSavePlayer(player.getName(), player.getUniqueId(), player.getLocation(), player.getInventory().getContents(), player.getInventory().getArmorContents(), player.getInventory().getItemInOffHand(), player.getLevel(),
player.getTotalExperience(), (int) health, player.getFoodLevel(), player.getFireTicks(), player.getGameMode(), player.getActivePotionEffects());
player.getTotalExperience(), player.getHealth(), player.getFoodLevel(), player.getFireTicks(), player.getGameMode(), player.getActivePotionEffects());
}
this.editing = editing;

View File

@ -58,13 +58,13 @@ public class DSavePlayer {
private ItemStack oldOffHand;
private int oldLvl;
private int oldExp;
private int oldHealth;
private double oldHealth;
private int oldFoodLevel;
private int oldFireTicks;
private GameMode oldGameMode;
private Collection<PotionEffect> oldPotionEffects;
public DSavePlayer(String name, UUID uuid, Location oldLocation, ArrayList<ItemStack> oldInventory, ArrayList<ItemStack> oldArmor, ItemStack oldOffHand, int oldLvl, int oldExp, int oldHealth, int oldFoodLevel, int oldFireTicks,
public DSavePlayer(String name, UUID uuid, Location oldLocation, ArrayList<ItemStack> oldInventory, ArrayList<ItemStack> oldArmor, ItemStack oldOffHand, int oldLvl, int oldExp, double oldHealth, int oldFoodLevel, int oldFireTicks,
GameMode oldGameMode, Collection<PotionEffect> oldPotionEffects) {
this.name = name;
this.uuid = uuid.toString();
@ -85,7 +85,7 @@ public class DSavePlayer {
dPlayers.addDSavePlayer(this);
}
public DSavePlayer(String name, UUID uuid, Location oldLocation, ItemStack[] oldInventory, ItemStack[] oldArmor, ItemStack oldOffHand, int oldLvl, int oldExp, int oldHealth, int oldFoodLevel, int oldFireTicks,
public DSavePlayer(String name, UUID uuid, Location oldLocation, ItemStack[] oldInventory, ItemStack[] oldArmor, ItemStack oldOffHand, int oldLvl, int oldExp, double oldHealth, int oldFoodLevel, int oldFireTicks,
GameMode oldGameMode, Collection<PotionEffect> oldPotionEffects) {
this(name, uuid, oldLocation, new ArrayList<>(Arrays.asList(oldInventory)), new ArrayList<>(Arrays.asList(oldArmor)), oldOffHand, oldLvl, oldExp, oldHealth, oldFoodLevel, oldFireTicks, oldGameMode, oldPotionEffects);
}
@ -198,7 +198,7 @@ public class DSavePlayer {
/**
* @return the old health
*/
public int getOldHealth() {
public double getOldHealth() {
return oldHealth;
}
@ -206,7 +206,7 @@ public class DSavePlayer {
* @param health
* the health to set
*/
public void setOldHealth(int health) {
public void setOldHealth(double health) {
oldHealth = health;
}