More updates & fixes for party & admin chat.

This commit is contained in:
GJ 2012-04-10 22:14:09 -04:00
parent a90e4e9c8d
commit 32422646e4
3 changed files with 15 additions and 15 deletions

View File

@ -55,6 +55,11 @@ public class ACommand implements CommandExecutor {
aMessage = aMessage + " " + args[i]; aMessage = aMessage + " " + args[i];
} }
Users.getProfile(player).toggleAdminChat();
player.chat(aMessage);
Users.getProfile(player).toggleAdminChat();
String name = player.getName(); String name = player.getName();
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + name + ChatColor.AQUA + "} "; String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + name + ChatColor.AQUA + "} ";
Bukkit.getLogger().info("[A]<" + name + "> " + aMessage); Bukkit.getLogger().info("[A]<" + name + "> " + aMessage);

View File

@ -11,7 +11,6 @@ import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.mcPermissions;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.party.Party;
public class PCommand implements CommandExecutor { public class PCommand implements CommandExecutor {
public PCommand() {} public PCommand() {}
@ -63,16 +62,9 @@ public class PCommand implements CommandExecutor {
pMessage = pMessage + " " + args[i]; pMessage = pMessage + " " + args[i];
} }
String name = player.getName(); PP.togglePartyChat();
String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + name + ChatColor.GREEN + ") "; player.chat(pMessage);
Bukkit.getLogger().info("[P](" + PP.getParty() + ")<" + name + "> " + pMessage); PP.togglePartyChat();
for (Player herp : Bukkit.getServer().getOnlinePlayers()) {
if (Users.getProfile(herp).inParty()) {
if (Party.getInstance().inSameParty(herp, player))
herp.sendMessage(pPrefix + pMessage);
}
}
return true; return true;
} }

View File

@ -298,6 +298,7 @@ public class mcPlayerListener implements Listener {
Set<Player> intendedRecipients = new HashSet<Player>(); Set<Player> intendedRecipients = new HashSet<Player>();
String header = ""; String header = "";
ChatColor color = null;
if (partyChat || adminChat) { if (partyChat || adminChat) {
@ -308,7 +309,8 @@ public class mcPlayerListener implements Listener {
return; return;
} }
header = ChatColor.GREEN + "[P] (" + PP.getParty() + ") "; color = ChatColor.GREEN;
header = color + "[P] (" + PP.getParty() + ") ";
for (Player x : plugin.getServer().getOnlinePlayers()) { for (Player x : plugin.getServer().getOnlinePlayers()) {
if (Party.getInstance().inSameParty(player, x)) { if (Party.getInstance().inSameParty(player, x)) {
@ -319,7 +321,8 @@ public class mcPlayerListener implements Listener {
} }
if (adminChat) { if (adminChat) {
header = ChatColor.AQUA + "[A] "; color = ChatColor.AQUA;
header = color + "[A] ";
for (Player x : plugin.getServer().getOnlinePlayers()) { for (Player x : plugin.getServer().getOnlinePlayers()) {
if (x.isOp() || mcPermissions.getInstance().adminChat(x)) { if (x.isOp() || mcPermissions.getInstance().adminChat(x)) {
@ -329,7 +332,7 @@ public class mcPlayerListener implements Listener {
} }
recipients.retainAll(intendedRecipients); recipients.retainAll(intendedRecipients);
event.setFormat(header + "<%1$s> " + ChatColor.WHITE + "%2$s"); event.setFormat(header + "<" + ChatColor.WHITE + "%1$s" + color + "> %2$s");
} }
} }