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"); + } - ess.broadcastMessage("essentials.ban.notify", tl("playerBanIpAddress", senderName, ipAddress)); + 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, 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}.