summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2014-07-12 17:03:11 +0100
committerKHobbits <rob@khobbits.co.uk>2014-07-12 17:23:11 +0100
commit394ea6f172e211853a5cbf6fdb732fc84b1d4c04 (patch)
treedb721ace8bc81b3564abcf5afd3779e32414327d /Essentials/src/com/earth2me/essentials/commands/Commandbanip.java
parentc4d5beea7e5820e2afd5b91c1b2d8941966ad19a (diff)
downloadEssentials-394ea6f172e211853a5cbf6fdb732fc84b1d4c04.tar
Essentials-394ea6f172e211853a5cbf6fdb732fc84b1d4c04.tar.gz
Essentials-394ea6f172e211853a5cbf6fdb732fc84b1d4c04.tar.lz
Essentials-394ea6f172e211853a5cbf6fdb732fc84b1d4c04.tar.xz
Essentials-394ea6f172e211853a5cbf6fdb732fc84b1d4c04.zip
Add ban reason to /banip
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands/Commandbanip.java')
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandbanip.java19
1 files changed, 16 insertions, 3 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java b/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java
index 3dea97ceb..fa0dcb449 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java
@@ -6,9 +6,12 @@ import static com.earth2me.essentials.I18n.tl;
import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.FormatUtil;
import java.util.logging.Level;
+import org.bukkit.BanList;
+import org.bukkit.Bukkit;
import org.bukkit.Server;
+//TODO: Add kick to online players matching ip ban.
public class Commandbanip extends EssentialsCommand
{
public Commandbanip()
@@ -49,9 +52,19 @@ public class Commandbanip extends EssentialsCommand
throw new PlayerNotFoundException();
}
- ess.getServer().banIP(ipAddress);
- server.getLogger().log(Level.INFO, tl("playerBanIpAddress", senderName, ipAddress));
+ String banReason;
+ if (args.length > 1)
+ {
+ banReason = FormatUtil.replaceFormat(getFinalArg(args, 1).replace("\\n", "\n").replace("|", "\n"));
+ }
+ else
+ {
+ banReason = tl("defaultBanReason");
+ }
+
+ Bukkit.getBanList(BanList.Type.IP).addBan(ipAddress, banReason, null, senderName);
+ server.getLogger().log(Level.INFO, tl("playerBanIpAddress", senderName, ipAddress, banReason));
- ess.broadcastMessage("essentials.ban.notify", tl("playerBanIpAddress", senderName, ipAddress));
+ ess.broadcastMessage("essentials.ban.notify", tl("playerBanIpAddress", senderName, ipAddress, banReason));
}
}