Made global chat async and added uuid to it everywhere
This commit is contained in:
@@ -4,10 +4,12 @@ import com.velocitypowered.api.command.CommandSource;
|
||||
|
||||
public class GlobalAdminChatEvent {
|
||||
private final CommandSource sender;
|
||||
private final String uuid;
|
||||
private final String message;
|
||||
|
||||
public GlobalAdminChatEvent(CommandSource sender, String message) {
|
||||
public GlobalAdminChatEvent(CommandSource sender, String uuid, String message) {
|
||||
this.sender = sender;
|
||||
this.uuid = uuid;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@@ -15,6 +17,10 @@ public class GlobalAdminChatEvent {
|
||||
return sender;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class ServerHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public void sendGlobalChat(String message) {
|
||||
public void sendGlobalChat(String uuid, String message) {
|
||||
// Component component = GsonComponentSerializer.gson().deserialize(message);
|
||||
|
||||
servers.stream()
|
||||
@@ -47,6 +47,7 @@ public class ServerHandler {
|
||||
.forEach(registeredServer -> {
|
||||
ByteArrayDataOutput buf = ByteStreams.newDataOutput();
|
||||
buf.writeUTF("globalchat");
|
||||
buf.writeUTF(uuid);
|
||||
buf.writeUTF(message);
|
||||
registeredServer.sendPluginMessage(VelocityChat.getPlugin().getChannelIdentifier(), buf.toByteArray());
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ public class PluginMessageListener {
|
||||
VelocityChat.getPlugin().getLogger().info("server " + event.getSource());
|
||||
switch (channel) {
|
||||
case "globalchat":
|
||||
VelocityChat.getPlugin().getServerHandler().sendGlobalChat(in.readUTF());
|
||||
VelocityChat.getPlugin().getServerHandler().sendGlobalChat(in.readUTF(), in.readUTF());
|
||||
break;
|
||||
case "globaladminchat":
|
||||
VelocityChat.getPlugin().getChatHandler().globalAdminChat(in.readUTF());
|
||||
|
||||
Reference in New Issue
Block a user