public void setFrozen(boolean freeze) { cancel(unfreezeTask); unfreezeTask = null; freezeLocation = null; if (player.getGameMode() != GameMode.CREATIVE) { TFM_Util.setFlying(player, false); } if (!freeze) { return; } freezeLocation = player.getLocation(); // Blockify location TFM_Util.setFlying(player, true); // Avoid infinite falling unfreezeTask = new BukkitRunnable() { @Override public void run() { TFM_Util.adminAction("TotalFreedom", "Unfreezing " + player.getName(), false); setFrozen(false); } }.runTaskLater(TotalFreedomMod.plugin, AUTO_PURGE); }
public void setHalted(boolean halted) { this.isHalted = halted; if (halted) { player.setOp(false); player.setGameMode(GameMode.SURVIVAL); TFM_Util.setFlying(player, false); TFM_EssentialsBridge.setNickname(player.getName(), player.getName()); player.closeInventory(); player.setTotalExperience(0); stopOrbiting(); setFrozen(true); setMuted(true); player.sendMessage(ChatColor.GRAY + "You have been halted, don't move!"); } else { player.setOp(true); player.setGameMode(GameMode.CREATIVE); setFrozen(false); setMuted(false); player.sendMessage(ChatColor.GRAY + "You are no longer halted."); } }