#3612: Error when disconnecting player on PostLoginEvent

This commit is contained in:
md_5 2024-02-04 11:47:30 +11:00
parent b52b14696c
commit 3e1007527c
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11
2 changed files with 16 additions and 9 deletions

View File

@ -10,6 +10,7 @@ import java.util.Locale;
import java.util.Queue; import java.util.Queue;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.logging.Level;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
@ -339,6 +340,14 @@ public class ServerConnector extends PacketHandler
private void cutThrough(ServerConnection server) private void cutThrough(ServerConnection server)
{ {
// TODO: Fix this?
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.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_20_2 )
{ {
if ( user.getServer() != null ) if ( user.getServer() != null )
@ -360,15 +369,6 @@ public class ServerConnector extends PacketHandler
user.getServer().disconnect( "Quitting" ); 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 // Add to new server
// TODO: Move this to the connected() method of DownstreamBridge // TODO: Move this to the connected() method of DownstreamBridge
target.addPlayer( user ); target.addPlayer( user );

View File

@ -653,6 +653,13 @@ public class InitialHandler extends PacketHandler implements PendingConnection
ch.getHandle().pipeline().get( HandlerBoss.class ).setHandler( new UpstreamBridge( bungee, userCon ) ); ch.getHandle().pipeline().get( HandlerBoss.class ).setHandler( new UpstreamBridge( bungee, userCon ) );
bungee.getPluginManager().callEvent( new PostLoginEvent( userCon ) ); bungee.getPluginManager().callEvent( new PostLoginEvent( userCon ) );
// #3612: Don't progress further if disconnected during event
if ( ch.isClosed() )
{
return;
}
ServerInfo server; ServerInfo server;
if ( bungee.getReconnectHandler() != null ) if ( bungee.getReconnectHandler() != null )
{ {