Reimplement VelocityDiscord

This commit is contained in:
jones6096 2024-01-06 14:14:16 -05:00
parent dd2057d905
commit bbd02becf1

View File

@ -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);
}
});
}