public static void fullReset(final Arena arena, final Player player) { playersetHealth(player, arena.getArenaConfig().getInt(CFG.PLAYER_HEALTH)); player.setFireTicks(0); player.setFallDistance(0); player.setVelocity(new Vector()); player.setFoodLevel(arena.getArenaConfig().getInt(CFG.PLAYER_FOODLEVEL)); player.setSaturation(arena.getArenaConfig().getInt(CFG.PLAYER_SATURATION)); player.setExhaustion((float) arena.getArenaConfig().getDouble(CFG.PLAYER_EXHAUSTION)); player.setLevel(0); player.setExp(0); player.setGameMode(GameMode.getByValue(arena.getArenaConfig().getInt(CFG.GENERAL_GAMEMODE))); PlayerState.removeEffects(player); }
public void unload() { final Player player = Bukkit.getPlayerExact(name); if (player == null) { final ArenaPlayer aPlayer = ArenaPlayer.parsePlayer(name); PVPArena.instance.getAgm().disconnect(aPlayer.getArena(), aPlayer); return; } debug.i("restoring PlayerState of " + name, player); player.setFireTicks(fireticks); player.setFoodLevel(foodlevel); player.setGameMode(GameMode.getByValue(gamemode)); final ArenaPlayer aPlayer = ArenaPlayer.parsePlayer(player.getName()); player.setFoodLevel(foodlevel); if (player.getMaxHealth() != maxhealth) { final double newHealth = player.getMaxHealth() * health / maxhealth; if (newHealth > player.getMaxHealth()) { player.setHealth(player.getMaxHealth()); } else { player.setHealth(newHealth); } } else { player.setHealth(health); } player.setSaturation(saturation); player.setGameMode(GameMode.getByValue(gamemode)); player.setLevel(explevel); player.setExp(experience); player.setExhaustion(exhaustion); player.setFallDistance(0); player.setVelocity(new Vector()); if (aPlayer.getArena() != null && aPlayer.getArena().getArenaConfig().getBoolean(CFG.CHAT_COLORNICK)) { player.setDisplayName(displayname); } if (aPlayer.getArena() != null) { ArenaModuleManager.unload(aPlayer.getArena(), player); PVPArena.instance.getAgm().unload(aPlayer.getArena(), player); } removeEffects(player); player.addPotionEffects(potionEffects); aPlayer.setTelePass(false); player.setFireTicks(fireticks); if (aPlayer.getArena() != null) { player.setNoDamageTicks( aPlayer.getArena().getArenaConfig().getInt(CFG.TIME_TELEPORTPROTECT) * 20); } player.resetPlayerTime(); if (flying && !player.getAllowFlight()) { player.setAllowFlight(true); } player.setFlying(flying); }