Update DiscordToAdminChatListener.java

This is the only way we can load media after [Discord] and [Formatting] without rewriting the method
This commit is contained in:
Paldiu 2021-03-22 09:57:09 -05:00
parent 5837b05a35
commit 97672c2fff

View file

@ -43,16 +43,6 @@ public class DiscordToAdminChatListener extends ListenerAdapter
message.append(msg.getContentDisplay());
ComponentBuilder builder = new ComponentBuilder(msg.toString());
if (!msg.getAttachments().isEmpty())
{
for (Message.Attachment attachment : msg.getAttachments())
{
TextComponent text = new TextComponent(ChatColor.YELLOW + "[Media]");
text.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, attachment.getUrl()));
builder.append(text);
message.append("[Media]"); // for logging
}
}
FLog.info(message.toString());
@ -77,6 +67,18 @@ public class DiscordToAdminChatListener extends ListenerAdapter
+ ChatColor.WHITE + ": " + ChatColor.GOLD + FUtil.colorize(msg.getContentDisplay());
builder.append(m);
}
if (!msg.getAttachments().isEmpty())
{
for (Message.Attachment attachment : msg.getAttachments())
{
TextComponent text = new TextComponent(ChatColor.YELLOW + "[Media]");
text.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, attachment.getUrl()));
builder.append(text);
message.append("[Media]"); // for logging
}
}
player.spigot().sendMessage(builder.create());
});
}