Allow the BungeeCord plugin messaging channel to be used by the server at transition time

This commit is contained in:
Andrew Steinborn 2021-09-07 07:38:30 -04:00
parent 4ca1798994
commit d1135bd190

View File

@ -51,6 +51,7 @@ public class TransitionSessionHandler implements MinecraftSessionHandler {
private final VelocityServer server;
private final VelocityServerConnection serverConn;
private final CompletableFuture<Impl> resultFuture;
private final BungeeCordMessageResponder bungeecordMessageResponder;
/**
* Creates the new transition handler.
@ -64,6 +65,8 @@ public class TransitionSessionHandler implements MinecraftSessionHandler {
this.server = server;
this.serverConn = serverConn;
this.resultFuture = resultFuture;
this.bungeecordMessageResponder = new BungeeCordMessageResponder(server,
serverConn.getPlayer());
}
@Override
@ -168,6 +171,10 @@ public class TransitionSessionHandler implements MinecraftSessionHandler {
@Override
public boolean handle(PluginMessage packet) {
if (bungeecordMessageResponder.process(packet)) {
return true;
}
if (PluginMessageUtil.isRegister(packet)) {
serverConn.getPlayer().getKnownChannels().addAll(PluginMessageUtil.getChannels(packet));
} else if (PluginMessageUtil.isUnregister(packet)) {