summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java
diff options
context:
space:
mode:
authorSkylexia-PC <skyla@skylexia.com>2013-03-10 18:43:20 -0400
committerKHobbits <rob@khobbits.co.uk>2013-03-10 23:41:17 +0000
commit68a5f1ba072c557e7a82c5403e51824230175e50 (patch)
treea80429958ee281fbf78316ae92d1750b25cf7548 /Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java
parent43ab68700df01da2cfc50ab5063705f5abeae4eb (diff)
downloadEssentials-68a5f1ba072c557e7a82c5403e51824230175e50.tar
Essentials-68a5f1ba072c557e7a82c5403e51824230175e50.tar.gz
Essentials-68a5f1ba072c557e7a82c5403e51824230175e50.tar.lz
Essentials-68a5f1ba072c557e7a82c5403e51824230175e50.tar.xz
Essentials-68a5f1ba072c557e7a82c5403e51824230175e50.zip
Shows IP unbans to online staff.
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java')
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java28
1 files changed, 23 insertions, 5 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java b/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java
index c539a596c..6e0526095 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java
@@ -1,9 +1,12 @@
package com.earth2me.essentials.commands;
+import com.earth2me.essentials.Console;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
+import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
public class Commandunbanip extends EssentialsCommand
@@ -20,15 +23,30 @@ public class Commandunbanip extends EssentialsCommand
{
throw new NotEnoughArgumentsException();
}
- try
+ String ipAddress;
+ if (Util.validIP(args[0]))
+ {
+ ipAddress = args[0];
+ }
+ else
{
final User user = getPlayer(server, args, 0, true);
- ess.getServer().unbanIP(user.getLastLoginAddress());
+ ipAddress = user.getLastLoginAddress();
+ if (ipAddress.isEmpty())
+ {
+ throw new PlayerNotFoundException();
+ }
}
- catch (Exception ex)
+
+ ess.getServer().unbanIP(ipAddress);
+ final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
+ for (Player onlinePlayer : server.getOnlinePlayers())
{
+ final User onlineUser = ess.getUser(onlinePlayer);
+ if (onlinePlayer == sender || onlineUser.isAuthorized("essentials.ban.notify"))
+ {
+ onlinePlayer.sendMessage(_("playerUnbanIpAddress", senderName, ipAddress));
+ }
}
- ess.getServer().unbanIP(args[0]);
- sender.sendMessage(_("unbannedIP"));
}
}