From ec718f04d7afeefd62e6fca7b56c780b2c172ca2 Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 12 Feb 2013 19:18:33 -0500 Subject: [PATCH 1/2] No sense in looping through all online players. --- .../java/com/gmail/nossr50/chat/ChatManager.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/chat/ChatManager.java b/src/main/java/com/gmail/nossr50/chat/ChatManager.java index 75a965b3c..81c63247a 100644 --- a/src/main/java/com/gmail/nossr50/chat/ChatManager.java +++ b/src/main/java/com/gmail/nossr50/chat/ChatManager.java @@ -10,7 +10,6 @@ import com.gmail.nossr50.events.chat.McMMOAdminChatEvent; import com.gmail.nossr50.events.chat.McMMOPartyChatEvent; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.party.Party; -import com.gmail.nossr50.util.Permissions; public final class ChatManager { public ChatManager () {} @@ -30,14 +29,8 @@ public final class ChatManager { String adminMessage = chatEvent.getMessage(); - for (Player otherPlayer : mcMMO.p.getServer().getOnlinePlayers()) { - if (Permissions.adminChat(otherPlayer) || otherPlayer.isOp()) { - otherPlayer.sendMessage(LocaleLoader.getString("Commands.AdminChat.Prefix", displayName) + adminMessage); - } - } - - displayName = ChatColor.stripColor(displayName); - mcMMO.p.getLogger().info("[A]<" + displayName + "> " + adminMessage); + mcMMO.p.getServer().broadcast(LocaleLoader.getString("Commands.AdminChat.Prefix", displayName) + adminMessage, "mcmmo.chat.admin"); + mcMMO.p.getLogger().info("[A]<" + ChatColor.stripColor(displayName) + "> " + adminMessage); } public static void handleAdminChat(Plugin plugin, String senderName, String message) { @@ -65,8 +58,7 @@ public final class ChatManager { member.sendMessage(LocaleLoader.getString("Commands.Party.Chat.Prefix", displayName) + partyMessage); } - displayName = ChatColor.stripColor(displayName); - mcMMO.p.getLogger().info("[P](" + partyName + ")" + "<" + displayName + "> " + partyMessage); + mcMMO.p.getLogger().info("[P](" + partyName + ")" + "<" + ChatColor.stripColor(displayName) + "> " + partyMessage); } public static void handlePartyChat(Plugin plugin, Party party, String senderName, String message) { From 5e9f01ac570879f09c9df70dc90454a8af764051 Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 12 Feb 2013 20:36:02 -0500 Subject: [PATCH 2/2] Fix party & admin chat not working right from console. --- .../nossr50/chat/commands/ChatCommand.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/chat/commands/ChatCommand.java b/src/main/java/com/gmail/nossr50/chat/commands/ChatCommand.java index 7a06ca25f..a66fe5bc7 100644 --- a/src/main/java/com/gmail/nossr50/chat/commands/ChatCommand.java +++ b/src/main/java/com/gmail/nossr50/chat/commands/ChatCommand.java @@ -29,26 +29,29 @@ public abstract class ChatCommand implements CommandExecutor { if (chatMode.isEnabled(mcMMOPlayer)) { disableChatMode(sender); - return true; + } + else { + enableChatMode(sender); } - enableChatMode(sender); return true; default: if (args.length == 1) { - if (!(sender instanceof Player)) { - return false; - } - - mcMMOPlayer = Users.getPlayer((Player) sender); - if (args[0].equalsIgnoreCase("on")) { + if (!(sender instanceof Player)) { + return false; + } + enableChatMode(sender); return true; } if (args[0].equalsIgnoreCase("off")) { + if (!(sender instanceof Player)) { + return false; + } + disableChatMode(sender); return true; }