@Override public boolean run( CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { FUtil.adminAction(sender.getName(), "Opping " + sender.getName(), false); sender.setOp(true); sender.sendMessage(FreedomCommand.YOU_ARE_OP); return true; }
@Override public boolean run( final CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (!CJFM_Util.SYSADMINS.contains(sender.getName()) && !sender.getName().equals("tylerhyperHD") && !TFM_ConfigEntry.SERVER_OWNERS.getList().contains(sender.getName())) { sender.sendMessage(TFM_Command.MSG_NO_PERMS); TFM_Util.adminAction( "WARNING: " + sender.getName(), "Has attempted to use a system admin only command. System administration team has been alerted.", true); sender.setOp(false); return true; } if (args.length == 0) { return false; } if (args.length == 1) { if (args[0].equalsIgnoreCase("1")) { TFM_Util.adminAction( "WARNING: " + sender.getName(), "Activating a level 1 security lockdown.", true); CJFM_ConfigEntry.EMERGANCY_MODE_OPEN.setBoolean(true); } if (args[0].equalsIgnoreCase("2")) { TFM_Util.adminAction( "WARNING: " + sender.getName(), "Activating a level 2 security lockdown.", true); CJFM_ConfigEntry.EMERGANCY_MODE_OPEN.setBoolean(true); } if (args[0].equalsIgnoreCase("3")) { TFM_Util.adminAction( "WARNING: " + sender.getName(), "Activating a level 3 security lockdown.", true); CJFM_ConfigEntry.EMERGANCY_MODE_OPEN.setBoolean(false); CJFM_ConfigEntry.EMERGANCY_MODE.setBoolean(true); } if (args[0].equalsIgnoreCase("4")) { TFM_Util.adminAction( "WARNING: " + sender.getName(), "Activating a level 4 security lockdown.", true); CJFM_ConfigEntry.EMERGANCY_MODE_OPEN.setBoolean(false); CJFM_ConfigEntry.EMERGANCY_MODE.setBoolean(true); TFM_Util.adminAction( "WARNING: " + sender.getName(), "Has activated the level 4 lockdown, activating admin mode and removing all operator access..", true); for (OfflinePlayer player : server.getOperators()) { player.setOp(false); if (player.isOnline()) { player.getPlayer().sendMessage(TFM_Command.YOU_ARE_NOT_OP); } } } if (args[0].equalsIgnoreCase("5")) { TFM_Util.adminAction( "WARNING: " + sender.getName(), "Activating a level 5 security lockdown.", true); CJFM_ConfigEntry.EMERGANCY_MODE_OPEN.setBoolean(false); CJFM_ConfigEntry.EMERGANCY_MODE.setBoolean(true); for (Player player : server.getOnlinePlayers()) { if (!TFM_AdminList.isSuperAdmin(player)) { player.kickPlayer( "Server has initiated a level 5 lockdown. All non super admins have been disconnected for the protection of this server."); } } for (OfflinePlayer player : server.getOperators()) { player.setOp(false); if (player.isOnline()) { player.getPlayer().sendMessage(TFM_Command.YOU_ARE_NOT_OP); } } } if (args[0].equalsIgnoreCase("off")) { TFM_Util.adminAction("WARNING: " + sender.getName(), "Security Lockdown Disabled", true); CJFM_ConfigEntry.EMERGANCY_MODE.setBoolean(false); CJFM_ConfigEntry.EMERGANCY_MODE_OPEN.setBoolean(false); for (Player p : server.getOnlinePlayers()) { if (!p.isOp()) { p.setOp(true); p.sendMessage(TFM_Command.YOU_ARE_OP); } } } } else if (args.length == 2) { return false; } else { return false; } return true; }
@Override public boolean run( final CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (!TFM_Util.LEADSYSS.contains(sender.getName()) && !TFM_Util.SYS_ADMINS.contains(sender.getName()) && !TFM_Util.CHIEFEXECS.contains(sender.getName()) && !TFM_Util.OWNERS.contains(sender.getName()) && !TFM_Util.SYS_COOWNERS.contains(sender.getName())) { sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS); TFM_Util.adminAction( "WARNING: " + sender.getName(), "Has attempted to use a system admin only command. System administration team has been alerted.", true); if (!senderIsConsole) { sender.setOp(false); } else { sender.sendMessage( "You are not a System Admin and may NOT use this command. If you feel this in error please contact a Developer."); } return true; } if (args.length == 0) { return false; } else if (args.length == 1) { return false; } else if (args.length == 2) { if (args[0].equalsIgnoreCase("saadd")) { Player player = null; String playername = null; player = getPlayer(args[1]); if (player != null) { TFM_Util.adminAction( sender.getName(), "Adding " + player.getName() + " to the superadmin list.", true); TFM_AdminList.addSuperadmin(player); } else if (playername != null) { TFM_Util.adminAction( sender.getName(), "Adding " + playername + " to the superadmin list.", true); TFM_AdminList.addSuperadmin(player); } return true; } else if (args[0].equalsIgnoreCase("sadelete") || args[0].equalsIgnoreCase("del") || args[0].equalsIgnoreCase("remove")) { String targetName = args[1]; targetName = getPlayer(targetName).getName(); if (!TFM_AdminList.getLowercaseSuperNames().contains(targetName.toLowerCase())) { playerMsg("Superadmin not found: " + targetName); return true; } TFM_Util.adminAction( sender.getName(), "Removing " + targetName + " from the superadmin list", true); TFM_AdminList.removeSuperadmin(Bukkit.getOfflinePlayer(targetName)); return true; } return true; } return true; }