Similarly return admin chat to ye olden method

This commit is contained in:
NuclearW 2012-05-30 11:18:25 -04:00
parent 75b287771a
commit 90296d87df
2 changed files with 20 additions and 17 deletions

View File

@ -63,15 +63,23 @@ public class ACommand implements CommandExecutor {
if (sender instanceof Player) {
Player player = (Player) sender;
PP = Users.getProfile(player);
if (PP.getAdminChatMode()) {
player.chat(message);
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent(player.getName(), message);
plugin.getServer().getPluginManager().callEvent(chatEvent);
if (chatEvent.isCancelled()) {
return true;
}
else {
PP.toggleAdminChat();
player.chat(message);
PP.toggleAdminChat();
message = chatEvent.getMessage();
String prefix = ChatColor.AQUA + "{" + ChatColor.WHITE + player.getName() + ChatColor.AQUA + "} ";
plugin.getLogger().info("[A]<" + player.getName() + "> " + message);
for (Player p : plugin.getServer().getOnlinePlayers()) {
if (Permissions.getInstance().adminChat(player) || player.isOp()) {
p.sendMessage(prefix + message);
}
}
}
else {

View File

@ -347,20 +347,15 @@ public class PlayerListener implements Listener {
return;
}
event.setMessage(chatEvent.getMessage());
String prefix = ChatColor.AQUA + "{" + ChatColor.WHITE + player.getName() + ChatColor.AQUA + "} ";
Set<Player> intendedRecipients = new HashSet<Player>();
plugin.getLogger().info("[A]<" + player.getName() + "> " + chatEvent.getMessage());
for (Player x : plugin.getServer().getOnlinePlayers()) {
if (x.isOp() || Permissions.getInstance().adminChat(x)) {
intendedRecipients.add(x);
for (Player p : plugin.getServer().getOnlinePlayers()) {
if (Permissions.getInstance().adminChat(player) || player.isOp()) {
p.sendMessage(prefix + chatEvent.getMessage());
}
}
ChatColor bracketColor = ChatColor.AQUA;
event.setFormat(bracketColor + "{" + ChatColor.WHITE + "%1$s" + bracketColor + "} %2$s");
event.getRecipients().retainAll(intendedRecipients);
}
}