From 32422646e4e2035c7a5e4657ffa75919fe75ed0a Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 10 Apr 2012 22:14:09 -0400 Subject: [PATCH] More updates & fixes for party & admin chat. --- .../gmail/nossr50/commands/party/ACommand.java | 5 +++++ .../gmail/nossr50/commands/party/PCommand.java | 16 ++++------------ .../nossr50/listeners/mcPlayerListener.java | 9 ++++++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/party/ACommand.java b/src/main/java/com/gmail/nossr50/commands/party/ACommand.java index d0cba874a..14ab0c893 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/ACommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/ACommand.java @@ -55,6 +55,11 @@ public class ACommand implements CommandExecutor { aMessage = aMessage + " " + args[i]; } + + Users.getProfile(player).toggleAdminChat(); + player.chat(aMessage); + Users.getProfile(player).toggleAdminChat(); + String name = player.getName(); String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + name + ChatColor.AQUA + "} "; Bukkit.getLogger().info("[A]<" + name + "> " + aMessage); diff --git a/src/main/java/com/gmail/nossr50/commands/party/PCommand.java b/src/main/java/com/gmail/nossr50/commands/party/PCommand.java index 3e4b38234..bee20a978 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/PCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/PCommand.java @@ -11,7 +11,6 @@ import com.gmail.nossr50.Users; import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.locale.mcLocale; -import com.gmail.nossr50.party.Party; public class PCommand implements CommandExecutor { public PCommand() {} @@ -62,17 +61,10 @@ public class PCommand implements CommandExecutor { for (int i = 1; i <= args.length - 1; i++) { pMessage = pMessage + " " + args[i]; } - - String name = player.getName(); - String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + name + ChatColor.GREEN + ") "; - Bukkit.getLogger().info("[P](" + PP.getParty() + ")<" + name + "> " + pMessage); - - for (Player herp : Bukkit.getServer().getOnlinePlayers()) { - if (Users.getProfile(herp).inParty()) { - if (Party.getInstance().inSameParty(herp, player)) - herp.sendMessage(pPrefix + pMessage); - } - } + + PP.togglePartyChat(); + player.chat(pMessage); + PP.togglePartyChat(); return true; } diff --git a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java index 5dea39673..8b4e16f60 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java @@ -298,6 +298,7 @@ public class mcPlayerListener implements Listener { Set intendedRecipients = new HashSet(); String header = ""; + ChatColor color = null; if (partyChat || adminChat) { @@ -308,7 +309,8 @@ public class mcPlayerListener implements Listener { return; } - header = ChatColor.GREEN + "[P] (" + PP.getParty() + ") "; + color = ChatColor.GREEN; + header = color + "[P] (" + PP.getParty() + ") "; for (Player x : plugin.getServer().getOnlinePlayers()) { if (Party.getInstance().inSameParty(player, x)) { @@ -319,7 +321,8 @@ public class mcPlayerListener implements Listener { } if (adminChat) { - header = ChatColor.AQUA + "[A] "; + color = ChatColor.AQUA; + header = color + "[A] "; for (Player x : plugin.getServer().getOnlinePlayers()) { if (x.isOp() || mcPermissions.getInstance().adminChat(x)) { @@ -329,7 +332,7 @@ public class mcPlayerListener implements Listener { } recipients.retainAll(intendedRecipients); - event.setFormat(header + "<%1$s> " + ChatColor.WHITE + "%2$s"); + event.setFormat(header + "<" + ChatColor.WHITE + "%1$s" + color + "> %2$s"); } }