From e73983649f776315dd39916fa8b6d1236eaf1e7d Mon Sep 17 00:00:00 2001 From: KHobbits Date: Wed, 9 Jan 2013 21:31:56 +0000 Subject: [PATCH] Ban cleanup --- .../src/com/earth2me/essentials/commands/Commandban.java | 4 +++- .../src/com/earth2me/essentials/commands/Commandkick.java | 3 ++- .../src/com/earth2me/essentials/commands/Commandkickall.java | 3 ++- .../src/com/earth2me/essentials/commands/Commandunban.java | 1 + Essentials/src/messages.properties | 2 +- Essentials/src/messages_en.properties | 2 +- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandban.java b/Essentials/src/com/earth2me/essentials/commands/Commandban.java index 776f4ab55..05e2b51c6 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandban.java @@ -4,6 +4,7 @@ import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.OfflinePlayer; import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; import java.util.logging.Level; import org.bukkit.Server; import org.bukkit.command.CommandSender; @@ -57,7 +58,7 @@ public class Commandban extends EssentialsCommand String banReason; if (args.length > 1) { - banReason = _("banFormat", getFinalArg(args, 1), senderName); + banReason = _("banFormat", Util.replaceFormat(getFinalArg(args, 1).replace("\\n", "\n")), senderName); } else { @@ -66,6 +67,7 @@ public class Commandban extends EssentialsCommand user.setBanReason(banReason); user.setBanned(true); + user.setBanTimeout(0); user.kickPlayer(banReason); server.getLogger().log(Level.INFO, _("playerBanned", senderName, user.getName(), banReason)); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java index c84441ac4..d977055e2 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java @@ -3,6 +3,7 @@ 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 java.util.logging.Level; import org.bukkit.Server; import org.bukkit.command.CommandSender; @@ -39,7 +40,7 @@ public class Commandkick extends EssentialsCommand } String kickReason = args.length > 1 ? getFinalArg(args, 1) : _("kickDefault"); - kickReason = kickReason.replace("\\n", "\n"); + kickReason = Util.replaceFormat(kickReason.replace("\\n", "\n")); target.kickPlayer(kickReason); final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java b/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java index 36b2c7e15..4fc0b20be 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java @@ -1,6 +1,7 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.Util; import org.bukkit.Server; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -17,7 +18,7 @@ public class Commandkickall extends EssentialsCommand public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception { String kickReason = args.length > 0 ? getFinalArg(args, 0) : _("kickDefault"); - kickReason = kickReason.replace("\\n", "\n"); + kickReason = Util.replaceFormat(kickReason.replace("\\n", "\n")); for (Player onlinePlayer : server.getOnlinePlayers()) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunban.java b/Essentials/src/com/earth2me/essentials/commands/Commandunban.java index 439e715e5..7d50eafa5 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandunban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandunban.java @@ -26,6 +26,7 @@ public class Commandunban extends EssentialsCommand { final User user = getPlayer(server, args, 0, true); user.setBanned(false); + user.setBanTimeout(0); sender.sendMessage(_("unbannedPlayer")); } catch (NoSuchFieldException e) diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index cec54fb85..9f27e5eea 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -23,7 +23,7 @@ backupStarted=\u00a76Backup started balance=\u00a7aBalance:\u00a7c {0} balanceTop=\u00a76Top balances ({0}) banExempt=\u00a74You can not ban that player. -banFormat=Banned: {0} +banFormat=\u00a74Banned:\n\u00a7r{0} banIpAddress=\u00a76Banned IP address bigTreeFailure=\u00a74Big tree generation failure. Try again on grass or dirt. bigTreeSuccess= \u00a76Big tree spawned. diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index cec54fb85..9f27e5eea 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -23,7 +23,7 @@ backupStarted=\u00a76Backup started balance=\u00a7aBalance:\u00a7c {0} balanceTop=\u00a76Top balances ({0}) banExempt=\u00a74You can not ban that player. -banFormat=Banned: {0} +banFormat=\u00a74Banned:\n\u00a7r{0} banIpAddress=\u00a76Banned IP address bigTreeFailure=\u00a74Big tree generation failure. Try again on grass or dirt. bigTreeSuccess= \u00a76Big tree spawned.