From f6b40b1186b8bf892158060d1f6cabd0502c1340 Mon Sep 17 00:00:00 2001 From: Outfluencer <git@outfluencer.dev> Date: Tue, 19 Nov 2024 10:20:17 +0100 Subject: [PATCH] #3758: Handle LoginPayloadResponse in UpstreamBridge --- .../java/net/md_5/bungee/connection/InitialHandler.java | 2 +- .../java/net/md_5/bungee/connection/UpstreamBridge.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java index 224f231b..2d365c39 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java @@ -904,7 +904,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection public CompletableFuture<byte[]> sendData(String channel, byte[] data) { Preconditions.checkState( getVersion() >= ProtocolConstants.MINECRAFT_1_13, "LoginPayloads are only supported in 1.13 and above" ); - Preconditions.checkState( loginRequest != null, "Cannot send login data for status or legacy connections" ); + Preconditions.checkState( ch.getEncodeProtocol() == Protocol.LOGIN, "LoginPayloads are only supported in the login phase" ); CompletableFuture<byte[]> future = new CompletableFuture<>(); final int id; diff --git a/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java index c9e3697e..49967de9 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java @@ -36,6 +36,7 @@ import net.md_5.bungee.protocol.packet.CookieResponse; import net.md_5.bungee.protocol.packet.FinishConfiguration; import net.md_5.bungee.protocol.packet.KeepAlive; import net.md_5.bungee.protocol.packet.LoginAcknowledged; +import net.md_5.bungee.protocol.packet.LoginPayloadResponse; import net.md_5.bungee.protocol.packet.PlayerListItem; import net.md_5.bungee.protocol.packet.PlayerListItemRemove; import net.md_5.bungee.protocol.packet.PluginMessage; @@ -378,6 +379,12 @@ public class UpstreamBridge extends PacketHandler con.getPendingConnection().handle( cookieResponse ); } + @Override + public void handle(LoginPayloadResponse loginPayloadResponse) throws Exception + { + con.getPendingConnection().handle( loginPayloadResponse ); + } + @Override public String toString() {