Added a terrible way to sync parties cus I don't have time to implement a proper solution atm

This commit is contained in:
2021-08-08 13:30:57 +02:00
parent 30cc4b3ead
commit 9551785f83
7 changed files with 132 additions and 87 deletions
@@ -1,6 +1,8 @@
package com.alttd.chat.listeners;
import com.alttd.chat.VelocityChat;
import com.alttd.chat.database.Queries;
import com.alttd.chat.managers.PartyManager;
import com.alttd.chat.objects.channels.CustomChannel;
import com.alttd.chat.util.ALogger;
import com.google.common.io.ByteArrayDataInput;
@@ -14,6 +16,7 @@ import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
import com.velocitypowered.api.proxy.server.RegisteredServer;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import java.util.Collection;
import java.util.UUID;
public class PluginMessageListener {
@@ -66,6 +69,12 @@ public class PluginMessageListener {
VelocityChat.getPlugin().getChatHandler().partyChat(in.readUTF(), UUID.fromString(in.readUTF()), GsonComponentSerializer.gson().deserialize(in.readUTF()));
break;
}
case "tmppartyupdate": {
int id = Integer.parseInt(in.readUTF());
Queries.loadPartyUsers(id);
VelocityChat.getPlugin().getProxy().getAllServers().forEach(registeredServer -> registeredServer.sendPluginMessage(VelocityChat.getPlugin().getChannelIdentifier(), event.getData()));
break;
}
default:
VelocityChat.getPlugin().getLogger().info("server " + event.getSource());
ProxyServer proxy = VelocityChat.getPlugin().getProxy();