From ad06bea3ae8768b48022d851ac329f12aeeb4f9f Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 5 May 2014 14:27:33 +0200 Subject: [PATCH] Fixed bugs with /saconfig clear. Resolves #167 Admins can now use /saconfig clear [ip] to remove the designated IP (only their own IPs can be removed. They can also simply use /saconfig clear to remove all IPs but the current one. /saconfig clear is safe, meaning you can't remove your current IP or an IP that doesn't belong to you. --- buildnumber.properties | 4 ++-- .../TotalFreedomMod/Commands/Command_saconfig.java | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/buildnumber.properties b/buildnumber.properties index 89b54af5..12c1a33d 100644 --- a/buildnumber.properties +++ b/buildnumber.properties @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Mon May 05 14:10:07 CEST 2014 -build.number=818 +#Mon May 05 14:23:17 CEST 2014 +build.number=820 diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_saconfig.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_saconfig.java index 5219ea99..fcb4e0d4 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_saconfig.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_saconfig.java @@ -67,21 +67,21 @@ public class Command_saconfig extends TFM_Command final TFM_Admin admin = TFM_AdminList.getEntry(sender_p); - TFM_Util.adminAction(sender.getName(), "Cleaning my supered IPs", true); - final String ip = TFM_Util.getIp(sender_p); if (args.length == 1) { + TFM_Util.adminAction(sender.getName(), "Cleaning my supered IPs", true); + int counter = 0; - for (String adminIp : (String[]) admin.getIps().toArray()) + for (int i = 0; i < admin.getIps().size(); i++) { - if (adminIp.equals(ip)) + if (admin.getIps().get(i).equals(ip)) { continue; } - admin.removeIp(ip); + admin.removeIp(admin.getIps().get(i)); counter++; } @@ -89,7 +89,6 @@ public class Command_saconfig extends TFM_Command playerMsg(counter + " IPs removed."); playerMsg(admin.getIps().get(0) + " is now your only IP address"); - return true; } @@ -106,12 +105,13 @@ public class Command_saconfig extends TFM_Command return true; } + TFM_Util.adminAction(sender.getName(), "Removing a supered IP", true); + admin.removeIp(args[1]); TFM_AdminList.save(); playerMsg("Removed IP " + args[1]); playerMsg("Current IPs: " + StringUtils.join(admin.getIps(), ", ")); - return true; }