mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Should fix FS-143
This commit is contained in:
parent
efac65bc76
commit
2a87271642
@ -159,24 +159,17 @@ public class ChatManager extends FreedomService
|
||||
FLog.info("[ADMIN] " + sender.getName() + " " + display.getTag() + ": " + message, true);
|
||||
plugin.dc.messageAdminChatChannel(sender.getName() + " \u00BB " + message);
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (plugin.al.isAdmin(player))
|
||||
{
|
||||
Admin admin = plugin.al.getAdmin(player);
|
||||
if (!Strings.isNullOrEmpty(admin.getAcFormat()))
|
||||
{
|
||||
String format = admin.getAcFormat();
|
||||
ChatColor color = getColor(display);
|
||||
String msg = format.replace("%name%", sender.getName()).replace("%rank%", display.getAbbr()).replace("%rankcolor%", color.toString()).replace("%msg%", message);
|
||||
player.sendMessage(FUtil.colorize(msg));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendMessage("[" + ChatColor.AQUA + "ADMIN" + ChatColor.WHITE + "] " + ChatColor.DARK_RED + sender.getName() + ChatColor.DARK_GRAY + " [" + getColoredTag(display) + ChatColor.DARK_GRAY + "]" + ChatColor.WHITE + ": " + ChatColor.GOLD + FUtil.colorize(message));
|
||||
}
|
||||
server.getOnlinePlayers().stream().filter(player -> plugin.al.isAdmin(player)).forEach(player -> {
|
||||
Admin admin = plugin.al.getAdmin(player);
|
||||
if (!Strings.isNullOrEmpty(admin.getAcFormat())) {
|
||||
String format = admin.getAcFormat();
|
||||
ChatColor color = getColor(display);
|
||||
String msg = format.replace("%name%", sender.getName()).replace("%rank%", display.getAbbr()).replace("%rankcolor%", color.toString()).replace("%msg%", message);
|
||||
player.sendMessage(FUtil.colorize(msg));
|
||||
} else {
|
||||
player.sendMessage("[" + ChatColor.AQUA + "ADMIN" + ChatColor.WHITE + "] " + ChatColor.DARK_RED + sender.getName() + ChatColor.DARK_GRAY + " [" + getColoredTag(display) + ChatColor.DARK_GRAY + "]" + ChatColor.WHITE + ": " + ChatColor.GOLD + FUtil.colorize(message));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void reportAction(Player reporter, Player reported, String report)
|
||||
|
@ -25,17 +25,9 @@ public class Admin
|
||||
private boolean active = true;
|
||||
private Rank rank = Rank.ADMIN;
|
||||
private Date lastLogin = new Date();
|
||||
|
||||
|
||||
private Boolean commandSpy = false;
|
||||
|
||||
|
||||
private Boolean potionSpy = false;
|
||||
|
||||
|
||||
private String acFormat = null;
|
||||
|
||||
|
||||
private String pteroID = null;
|
||||
|
||||
public Admin(Player player)
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.totalfreedom.totalfreedommod.discord;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
@ -38,42 +39,14 @@ public class DiscordToAdminChatListener extends ListenerAdapter
|
||||
String tag = dtml.getDisplay(member);
|
||||
StringBuilder message = new StringBuilder(ChatColor.DARK_GRAY + "[" + ChatColor.DARK_AQUA + "Discord" + ChatColor.DARK_GRAY + "] " + ChatColor.RESET);
|
||||
Message msg = event.getMessage();
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (TotalFreedomMod.getPlugin().al.isAdmin(player))
|
||||
{
|
||||
Admin admin = TotalFreedomMod.getPlugin().al.getAdmin(player);
|
||||
String format = admin.getAcFormat();
|
||||
if (format != null)
|
||||
{
|
||||
Displayable display = TotalFreedomMod.getPlugin().rm.getDisplay(player);
|
||||
net.md_5.bungee.api.ChatColor color = getColor(display);
|
||||
String m = format.replace("%name%", member.getEffectiveName())
|
||||
.replace("%rank%", getDisplay(member))
|
||||
.replace("%rankcolor%", color.toString())
|
||||
.replace("%msg%", FUtil.colorize(msg.getContentDisplay()));
|
||||
message.append(FUtil.colorize(m));
|
||||
}
|
||||
else
|
||||
{
|
||||
String m = ChatColor.DARK_RED + member.getEffectiveName() + " "
|
||||
+ ChatColor.DARK_GRAY + tag + ChatColor.DARK_GRAY
|
||||
+ ChatColor.WHITE + ": " + ChatColor.GOLD + FUtil.colorize(msg.getContentDisplay());
|
||||
message.append(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ComponentBuilder builder = new ComponentBuilder(message.toString());
|
||||
message.append(msg.getContentDisplay());
|
||||
|
||||
ComponentBuilder builder = new ComponentBuilder(msg.toString());
|
||||
if (!msg.getAttachments().isEmpty())
|
||||
{
|
||||
for (Message.Attachment attachment : msg.getAttachments())
|
||||
{
|
||||
if (attachment.getUrl() == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TextComponent text = new TextComponent(ChatColor.YELLOW + "[Media]");
|
||||
text.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, attachment.getUrl()));
|
||||
builder.append(text);
|
||||
@ -81,14 +54,27 @@ public class DiscordToAdminChatListener extends ListenerAdapter
|
||||
}
|
||||
}
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (TotalFreedomMod.getPlugin().al.isAdmin(player))
|
||||
{
|
||||
player.spigot().sendMessage(builder.create());
|
||||
}
|
||||
}
|
||||
FLog.info(message.toString());
|
||||
|
||||
Bukkit.getOnlinePlayers().stream().filter(player -> TotalFreedomMod.getPlugin().al.isAdmin(player)).forEach(player -> {
|
||||
Admin admin = TotalFreedomMod.getPlugin().al.getAdmin(player);
|
||||
String format = admin.getAcFormat();
|
||||
if (!Strings.isNullOrEmpty(format)) {
|
||||
Displayable display = TotalFreedomMod.getPlugin().rm.getDisplay(player);
|
||||
net.md_5.bungee.api.ChatColor color = getColor(display);
|
||||
String m = format.replace("%name%", member.getEffectiveName())
|
||||
.replace("%rank%", getDisplay(member))
|
||||
.replace("%rankcolor%", color.toString())
|
||||
.replace("%msg%", FUtil.colorize(msg.getContentDisplay()));
|
||||
builder.append(FUtil.colorize(m));
|
||||
} else {
|
||||
String m = ChatColor.DARK_RED + member.getEffectiveName() + " "
|
||||
+ ChatColor.DARK_GRAY + tag + ChatColor.DARK_GRAY
|
||||
+ ChatColor.WHITE + ": " + ChatColor.GOLD + FUtil.colorize(msg.getContentDisplay());
|
||||
builder.append(m);
|
||||
}
|
||||
player.spigot().sendMessage(builder.create());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user