Merge pull request #79 from DRE2N/0.11.x

Use double to store health
This commit is contained in:
Daniel Saukel 2016-05-28 19:08:18 +02:00
commit 83a6934d87
3 changed files with 8 additions and 10 deletions

View File

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

View File

@ -99,15 +99,13 @@ public class DGamePlayer extends DGlobalPlayer {
this.world = world; this.world = world;
double health = player.getHealth();
if (!Version.andHigher(Version.MC1_9).contains(CompatibilityHandler.getInstance().getVersion())) { 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(), 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 { } else {
savePlayer = new DSavePlayer(player.getName(), player.getUniqueId(), player.getLocation(), player.getInventory().getContents(), player.getInventory().getArmorContents(), player.getInventory().getItemInOffHand(), player.getLevel(), 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; this.editing = editing;

View File

@ -58,13 +58,13 @@ public class DSavePlayer {
private ItemStack oldOffHand; private ItemStack oldOffHand;
private int oldLvl; private int oldLvl;
private int oldExp; private int oldExp;
private int oldHealth; private double oldHealth;
private int oldFoodLevel; private int oldFoodLevel;
private int oldFireTicks; private int oldFireTicks;
private GameMode oldGameMode; private GameMode oldGameMode;
private Collection<PotionEffect> oldPotionEffects; 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) { GameMode oldGameMode, Collection<PotionEffect> oldPotionEffects) {
this.name = name; this.name = name;
this.uuid = uuid.toString(); this.uuid = uuid.toString();
@ -85,7 +85,7 @@ public class DSavePlayer {
dPlayers.addDSavePlayer(this); 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) { 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); 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 * @return the old health
*/ */
public int getOldHealth() { public double getOldHealth() {
return oldHealth; return oldHealth;
} }
@ -206,7 +206,7 @@ public class DSavePlayer {
* @param health * @param health
* the health to set * the health to set
*/ */
public void setOldHealth(int health) { public void setOldHealth(double health) {
oldHealth = health; oldHealth = health;
} }