Skip to content

Commit

Permalink
#3612: Error when disconnecting player on PostLoginEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
md-5 committed Feb 4, 2024
1 parent b52b146 commit 3e10075
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
18 changes: 9 additions & 9 deletions proxy/src/main/java/net/md_5/bungee/ServerConnector.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.Queue;
import java.util.Set;
import java.util.UUID;
import java.util.logging.Level;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import net.md_5.bungee.api.ChatColor;
Expand Down Expand Up @@ -339,6 +340,14 @@ public static void handleLogin(ProxyServer bungee, ChannelWrapper ch, UserConnec

private void cutThrough(ServerConnection server)
{
// TODO: Fix this?

This comment has been minimized.

Copy link
@Janmm14

Janmm14 Feb 4, 2024

Contributor

This todo seems pretty vague

if ( !user.isActive() )
{
server.disconnect( "Quitting" );
bungee.getLogger().log( Level.WARNING, "[{0}] No client connected for pending server!", user );
return;
}

if ( user.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_20_2 )
{
if ( user.getServer() != null )
Expand All @@ -360,15 +369,6 @@ private void cutThrough(ServerConnection server)
user.getServer().disconnect( "Quitting" );
}

// TODO: Fix this?
if ( !user.isActive() )
{
server.disconnect( "Quitting" );
// Silly server admins see stack trace and die
bungee.getLogger().warning( "No client connected for pending server!" );
return;
}

// Add to new server
// TODO: Move this to the connected() method of DownstreamBridge
target.addPlayer( user );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,13 @@ private void finish2()

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

// #3612: Don't progress further if disconnected during event
if ( ch.isClosed() )
{
return;
}

ServerInfo server;
if ( bungee.getReconnectHandler() != null )
{
Expand Down

0 comments on commit 3e10075

Please sign in to comment.