diff options
author | KHobbits <rob@khobbits.co.uk> | 2014-07-12 17:03:11 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2014-07-12 17:23:11 +0100 |
commit | 394ea6f172e211853a5cbf6fdb732fc84b1d4c04 (patch) | |
tree | db721ace8bc81b3564abcf5afd3779e32414327d | |
parent | c4d5beea7e5820e2afd5b91c1b2d8941966ad19a (diff) | |
download | Essentials-394ea6f172e211853a5cbf6fdb732fc84b1d4c04.tar Essentials-394ea6f172e211853a5cbf6fdb732fc84b1d4c04.tar.gz Essentials-394ea6f172e211853a5cbf6fdb732fc84b1d4c04.tar.lz Essentials-394ea6f172e211853a5cbf6fdb732fc84b1d4c04.tar.xz Essentials-394ea6f172e211853a5cbf6fdb732fc84b1d4c04.zip |
Add ban reason to /banip
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandbanip.java | 19 | ||||
-rw-r--r-- | Essentials/src/messages.properties | 4 |
2 files changed, 18 insertions, 5 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)); } } diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index c15d5734d..18dfaecab 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -321,8 +321,8 @@ pWeatherPlayers=\u00a76These players have their own weather\:\u00a7r pWeatherReset=\u00a76Player weather has been reset for\: \u00a7c{0} pWeatherSet=\u00a76Player weather is set to \u00a7c{0}\u00a76 for\: \u00a7c{1}. pendingTeleportCancelled=\u00a74Pending teleportation request cancelled. -playerBanIpAddress=\u00a76Player\u00a7c {0} \u00a76banned IP address\:\u00a7c {1}\u00a76. -playerBanned=\u00a76Player\u00a7c {0} \u00a76banned\u00a7c {1} \u00a76for \u00a7c{2}\u00a76. +playerBanIpAddress=\u00a76Player\u00a7c {0} \u00a76banned IP address\u00a7c {1} \u00a76for\: \u00a7c{2}\u00a76. +playerBanned=\u00a76Player\u00a7c {0} \u00a76banned\u00a7c {1} \u00a76for\: \u00a7c{2}\u00a76. playerInJail=\u00a74Player is already in jail\u00a7c {0}\u00a74. playerJailed=\u00a76Player\u00a7c {0} \u00a76jailed. playerJailedFor=\u00a76Player\u00a7c {0} \u00a76jailed for {1}. |