mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-01-19 16:59:37 +01:00
Similarly return admin chat to ye olden method
This commit is contained in:
parent
75b287771a
commit
90296d87df
@ -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;
|
||||
}
|
||||
|
||||
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 {
|
||||
PP.toggleAdminChat();
|
||||
player.chat(message);
|
||||
PP.toggleAdminChat();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user