.getActivePotionEffects(), playerTitle, player
.getLevel(), player.getExp(), player.getAllowFlight()));
}
public void restorePlayerState(Player player) {
PlayerState originalState = this.playerStates.remove(player.getName());
PlayerInventory playerInv = player.getInventory();
if (originalState != null) {
// prevent item hacking thru CRAFTING personal inventory slots
this.preventItemHackingThroughOpenedInventory(player);
this.playerInvFromInventoryStash(playerInv, originalState);
player.setGameMode(originalState.getGamemode());
player.setHealth(Math.max(Math.min(originalState.getHealth(), 20.0D), 0.0D));
player.setExhaustion(originalState.getExhaustion());
player.setSaturation(originalState.getSaturation());
player.setFoodLevel(originalState.getFoodLevel());
PotionEffectHelper.restorePotionEffects(player, originalState.getPotionEffects());
player.setLevel(originalState.getLevel());
player.setExp(originalState.getExp());
player.setAllowFlight(originalState.canFly());
if (War.war.isSpoutServer()) {
SpoutManager.getPlayer(player).setTitle(originalState.getPlayerTitle());
}
}
player.setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard());
}