@Override public boolean run( CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (!TFM_Util.SYSADMINS.contains(sender.getName()) || TFM_AdminList.isAdminImpostor((Player) sender)) { playerMsg(ChatColor.YELLOW + "You do not have permission to use this command."); TFM_Util.bcastMsg( "WARNING: " + sender.getName() + " has attempted to use an executive only command!", ChatColor.RED); return true; } if (args.length == 0) { return false; } String mode = args[0].toLowerCase(); if (mode.equals("add")) { Player player = getPlayer(args[1]); if (player == null) { sender.sendMessage(ChatColor.GRAY + "Player not found."); } TFM_Util.adminAction(sender.getName(), "Adding " + args[1] + " to the superadmin list", true); TFM_AdminList.addSuperadmin(player); } if (mode.equals("del")) { Player player = getPlayer(args[1]); if (player == null) { sender.sendMessage(ChatColor.GRAY + "Player not found."); } TFM_Util.adminAction( sender.getName(), "Deleting user: "******" from the superadmin list", true); TFM_AdminList.removeSuperadmin(player); } if (mode.equals("teston")) { TFM_Util.bcastMsg( ChatColor.RED + "WARNING: " + sender.getName() + " has started testing on this server."); } if (mode.equals("testoff")) { TFM_Util.bcastMsg( ChatColor.RED + sender.getName() + " has successfully finished testing on this server."); } 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; }