summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java
diff options
context:
space:
mode:
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));
}
}