Skip to content

Commit

Permalink
Move setHandler UpstreamBridge into the PostLoginEvent callback
Browse files Browse the repository at this point in the history
also change a little check for loginpayloads
it should only be possible to use this method while in login phase.
  • Loading branch information
Outfluencer authored Oct 26, 2024
1 parent 4886c4b commit d7c4904
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -660,8 +660,6 @@ private void finish2()
return;
}

ch.getHandle().pipeline().get( HandlerBoss.class ).setHandler( new UpstreamBridge( bungee, userCon ) );

ServerInfo initialServer;
if ( bungee.getReconnectHandler() != null )
{
Expand All @@ -686,6 +684,7 @@ public void done(PostLoginEvent result, Throwable error)
return;
}

ch.getHandle().pipeline().get( HandlerBoss.class ).setHandler( new UpstreamBridge( bungee, userCon ) );
userCon.connect( result.getTarget(), null, true, ServerConnectEvent.Reason.JOIN_PROXY );
}
};
Expand Down Expand Up @@ -904,7 +903,7 @@ public CompletableFuture<byte[]> retrieveCookie(String cookie)
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;
Expand Down

0 comments on commit d7c4904

Please sign in to comment.