Old admin mode and commandspy saving

This commit is contained in:
ZeroEpoch1969
2018-04-19 07:29:19 -07:00
parent 200a856413
commit ffbe71f5dd
10 changed files with 135 additions and 29 deletions

View File

@ -1,6 +1,8 @@
package me.totalfreedom.totalfreedommod;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Displayable;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FSync;
import static me.totalfreedom.totalfreedommod.util.FUtil.playerMsg;
@ -129,17 +131,43 @@ public class ChatManager extends FreedomService
}
}
public String getOldPrefix(Displayable display)
{
ChatColor color = display.getColor();
if (color.equals(ChatColor.AQUA))
{
color = ChatColor.GOLD;
}
else if (color.equals(ChatColor.GOLD))
{
color = ChatColor.LIGHT_PURPLE;
}
String prefix = "(" + display.getAbbr() + ")";
return color + prefix;
}
public void adminChat(CommandSender sender, String message)
{
String name = sender.getName() + " " + plugin.rm.getDisplay(sender).getColoredTag() + ChatColor.WHITE;
FLog.info("[ADMIN] " + name + ": " + message);
Displayable display = plugin.rm.getDisplay(sender);
FLog.info("[ADMIN] " + sender.getName() + " " + display.getTag() + ": " + message);
checkMentions(message, true);
for (Player player : server.getOnlinePlayers())
{
if (plugin.al.isAdmin(player))
{
player.sendMessage("[" + ChatColor.AQUA + "ADMIN" + ChatColor.WHITE + "] " + ChatColor.DARK_RED + name + ": " + ChatColor.GOLD + message);
Admin admin = plugin.al.getAdmin(player);
if (admin.getOldAdminMode())
{
player.sendMessage("[" + ChatColor.AQUA + "ADMIN" + ChatColor.WHITE + "] " + ChatColor.DARK_RED + sender.getName() + " " + getOldPrefix(display) + ChatColor.WHITE + ": " + ChatColor.AQUA + message);
}
else
{
player.sendMessage("[" + ChatColor.AQUA + "ADMIN" + ChatColor.WHITE + "] " + ChatColor.DARK_RED + sender.getName() + " " + display.getColoredTag() + ChatColor.WHITE + ": " + ChatColor.GOLD + message);
}
}
}
}