Merge pull request #12 from MClausz/master
Store & Restore player's max health
This commit is contained in:
commit
49af6f78ff
@ -106,7 +106,7 @@ public class ArenaHandler {
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
PlayerArenaData pad = new PlayerArenaData(player.getLocation(), player.getGameMode(), player.getInventory().getContents(), player
|
||||
.getInventory().getArmorContents(), player.getExp(), player.getLevel(), player.getHealth(), player.getFoodLevel(),
|
||||
.getInventory().getArmorContents(), player.getExp(), player.getLevel(), player.getMaxHealth(), player.getHealth(), player.getFoodLevel(),
|
||||
player.getActivePotionEffects(), player.getAllowFlight());
|
||||
|
||||
W.pData.put(player, pad);
|
||||
@ -118,6 +118,7 @@ public class ArenaHandler {
|
||||
}
|
||||
player.setFoodLevel(20);
|
||||
player.setHealth(20);
|
||||
player.setMaxHealth(20);
|
||||
player.setLevel(arena.timer);
|
||||
player.setExp(0);
|
||||
player.getInventory().clear();
|
||||
@ -287,7 +288,7 @@ public class ArenaHandler {
|
||||
}
|
||||
}
|
||||
|
||||
PlayerArenaData pad = new PlayerArenaData(null, null, null, null, null, null, null, null, null, false);
|
||||
PlayerArenaData pad = new PlayerArenaData(null, null, null, null, null, null, null, null, null, null, false);
|
||||
|
||||
if (W.pData.get(player) != null) {
|
||||
pad = W.pData.get(player);
|
||||
@ -299,6 +300,7 @@ public class ArenaHandler {
|
||||
player.updateInventory();
|
||||
player.setExp(pad.pEXP);
|
||||
player.setLevel(pad.pEXPL);
|
||||
player.setMaxHealth(pad.pMaxHealth);
|
||||
player.setHealth(pad.pHealth);
|
||||
player.setFoodLevel(pad.pFood);
|
||||
player.addPotionEffects(pad.pPotionEffects);
|
||||
@ -469,4 +471,4 @@ public class ArenaHandler {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,18 +13,20 @@ public class PlayerArenaData {
|
||||
public ItemStack[] pArmor;
|
||||
public Float pEXP;
|
||||
public Integer pEXPL;
|
||||
public Double pMaxHealth;
|
||||
public Double pHealth;
|
||||
public Integer pFood;
|
||||
public Collection<PotionEffect> pPotionEffects;
|
||||
public boolean pFlying;
|
||||
|
||||
public PlayerArenaData(Location pLocation, GameMode pGameMode, ItemStack[] pInventory, ItemStack[] pArmor, Float pEXP, Integer pEXPL, Double pHealth, Integer pFood,
|
||||
public PlayerArenaData(Location pLocation, GameMode pGameMode, ItemStack[] pInventory, ItemStack[] pArmor, Float pEXP, Integer pEXPL, Double pMaxHealth, Double pHealth, Integer pFood,
|
||||
Collection<PotionEffect> pPotionEffects, boolean pFlying) {
|
||||
this.pGameMode = pGameMode;
|
||||
this.pInventory = pInventory;
|
||||
this.pArmor = pArmor;
|
||||
this.pEXP = pEXP;
|
||||
this.pEXPL = pEXPL;
|
||||
this.pMaxHealth = pMaxHealth;
|
||||
this.pHealth = pHealth;
|
||||
this.pFood = pFood;
|
||||
this.pPotionEffects = pPotionEffects;
|
||||
|
Loading…
x
Reference in New Issue
Block a user