From 6b70e71abb85f9d8e0cc22211c072f5f2a319495 Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Sun, 22 May 2016 20:30:06 +0200 Subject: [PATCH] Use double to store health --- pom.xml | 2 +- .../io/github/dre2n/dungeonsxl/player/DGamePlayer.java | 6 ++---- .../io/github/dre2n/dungeonsxl/player/DSavePlayer.java | 10 +++++----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 1c92e4b7..67df3ddc 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 io.github.dre2n dungeonsxl - 0.11.3 + 0.11.4 jar DungeonsXL https://dre2n.github.io diff --git a/src/main/java/io/github/dre2n/dungeonsxl/player/DGamePlayer.java b/src/main/java/io/github/dre2n/dungeonsxl/player/DGamePlayer.java index 64fa16e3..d55abd05 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/player/DGamePlayer.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/player/DGamePlayer.java @@ -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; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/player/DSavePlayer.java b/src/main/java/io/github/dre2n/dungeonsxl/player/DSavePlayer.java index 62d31712..d6fef445 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/player/DSavePlayer.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/player/DSavePlayer.java @@ -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 oldPotionEffects; - public DSavePlayer(String name, UUID uuid, Location oldLocation, ArrayList oldInventory, ArrayList oldArmor, ItemStack oldOffHand, int oldLvl, int oldExp, int oldHealth, int oldFoodLevel, int oldFireTicks, + public DSavePlayer(String name, UUID uuid, Location oldLocation, ArrayList oldInventory, ArrayList oldArmor, ItemStack oldOffHand, int oldLvl, int oldExp, double oldHealth, int oldFoodLevel, int oldFireTicks, GameMode oldGameMode, Collection 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 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; }