From bbd02becf1971b5dac10872396c4df53f87fea84 Mon Sep 17 00:00:00 2001 From: jones6096 Date: Sat, 6 Jan 2024 14:14:16 -0500 Subject: [PATCH] Reimplement VelocityDiscord --- .../java/me/feusalamander/vmessage/Listeners.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/feusalamander/vmessage/Listeners.java b/src/main/java/me/feusalamander/vmessage/Listeners.java index e14c00a..7c7c3a8 100644 --- a/src/main/java/me/feusalamander/vmessage/Listeners.java +++ b/src/main/java/me/feusalamander/vmessage/Listeners.java @@ -15,7 +15,7 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.luckperms.api.LuckPerms; import net.luckperms.api.LuckPermsProvider; import net.luckperms.api.cacheddata.CachedMetaData; - +import ooo.foooooooooooo.velocitydiscord.VelocityDiscord; import java.util.Arrays; import java.util.Objects; @@ -102,8 +102,10 @@ public final class Listeners { } if (configuration.isMinimessageEnabled()) { proxyServer.sendMessage(mm.deserialize(message.replace("§", ""))); + if(VMessage.isDiscord())VelocityDiscord.getDiscord().sendMessage(discordRaw); } else { proxyServer.sendMessage(SERIALIZER.deserialize(message)); + if(VMessage.isDiscord())VelocityDiscord.getDiscord().sendMessage(discordRaw); } } @@ -157,8 +159,10 @@ public final class Listeners { } if (configuration.isMinimessageEnabled()) { proxyServer.sendMessage(mm.deserialize(message.replace("§", ""))); + if(VMessage.isDiscord())VelocityDiscord.getDiscord().sendMessage(discordRaw); } else { proxyServer.sendMessage(SERIALIZER.deserialize(message)); + if(VMessage.isDiscord())VelocityDiscord.getDiscord().sendMessage(discordRaw); } } @@ -221,8 +225,10 @@ public final class Listeners { } if (configuration.isMinimessageEnabled()) { proxyServer.sendMessage(mm.deserialize(message.replace("§", ""))); + if(VMessage.isDiscord())VelocityDiscord.getDiscord().sendMessage(discordRaw); } else { proxyServer.sendMessage(SERIALIZER.deserialize(message)); + if(VMessage.isDiscord())VelocityDiscord.getDiscord().sendMessage(discordRaw); } } else if (serverConnection.isPresent()){ if (!configuration.isJoinEnabled()) { @@ -268,8 +274,10 @@ public final class Listeners { } if (configuration.isMinimessageEnabled()) { proxyServer.sendMessage(mm.deserialize(message.replace("§", ""))); + if(VMessage.isDiscord())VelocityDiscord.getDiscord().sendMessage(discordRaw); } else { proxyServer.sendMessage(SERIALIZER.deserialize(message)); + if(VMessage.isDiscord())VelocityDiscord.getDiscord().sendMessage(discordRaw); } } } @@ -342,11 +350,13 @@ public final class Listeners { } if(configuration.isAllEnabled()){ proxyServer.sendMessage(finalMessage); + if(VMessage.isDiscord())VelocityDiscord.getDiscord().sendMessage(discordRaw); }else { final Component FMessage = finalMessage; proxyServer.getAllServers().forEach(server -> { if (!Objects.equals(p.getCurrentServer().map(ServerConnection::getServerInfo).orElse(null), server.getServerInfo())) { server.sendMessage(FMessage); + if(VMessage.isDiscord())VelocityDiscord.getDiscord().sendMessage(discordRaw); } }); }