From 49881402683c7f8678658f6bd1f2dc67abae9dc8 Mon Sep 17 00:00:00 2001 From: StevenLawson Date: Sat, 2 Aug 2014 11:14:37 -0400 Subject: [PATCH] Fixed mixed string concatenation / String.format usage. Doesn't make much sense to use string concatenation and a String.format to generate the same output. I believe this method is much more readable. --- .../TotalFreedomMod/Commands/Command_gtfo.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_gtfo.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_gtfo.java index e0543127..85f9885a 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_gtfo.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_gtfo.java @@ -77,7 +77,13 @@ public class Command_gtfo extends TFM_Command // ban IP address: String ip = TFM_Util.getFuzzyIp(player.getAddress().getAddress().getHostAddress()); - TFM_Util.bcastMsg(String.format("Banning: %s, IP: %s.", player.getName(), ip) + ChatColor.RED + (reason != null ? ("Reason: " + ChatColor.YELLOW + reason) : "")); + + final StringBuilder bcast = new StringBuilder("Banning: ").append(player.getName()).append(", IP: ").append(ip); + if (reason != null) + { + bcast.append(ChatColor.RED).append(" - Reason: ").append(ChatColor.YELLOW).append(reason); + } + TFM_Util.bcastMsg(bcast.toString()); TFM_BanManager.addIpBan(new TFM_Ban(ip, player.getName(), sender.getName(), null, reason));