From 97672c2fff8b4de48ffbfd32a8dd39edccb2decd Mon Sep 17 00:00:00 2001 From: Paldiu Date: Mon, 22 Mar 2021 09:57:09 -0500 Subject: [PATCH] Update DiscordToAdminChatListener.java This is the only way we can load media after [Discord] and [Formatting] without rewriting the method --- .../discord/DiscordToAdminChatListener.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToAdminChatListener.java b/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToAdminChatListener.java index 29814c3d..7be85478 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToAdminChatListener.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToAdminChatListener.java @@ -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()); }); }