#3695, #3696: Connect player to fallback if backend disconnects silently

This commit is contained in:
Outfluencer 2024-06-23 00:47:05 +02:00 committed by GitHub
parent df413f62db
commit cda4537fba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -103,7 +103,7 @@ public class DownstreamBridge extends PacketHandler
{
server.setObsolete( true );
con.connectNow( def, ServerConnectEvent.Reason.SERVER_DOWN_REDIRECT );
con.sendMessage( bungee.getTranslation( "server_went_down" ) );
con.sendMessage( bungee.getTranslation( "server_went_down", def.getName() ) );
} else
{
con.disconnect( Util.exception( t ) );
@ -120,13 +120,25 @@ public class DownstreamBridge extends PacketHandler
bungee.getReconnectHandler().setServer( con );
}
if ( !server.isObsolete() )
ServerDisconnectEvent serverDisconnectEvent = new ServerDisconnectEvent( con, server.getInfo() );
bungee.getPluginManager().callEvent( serverDisconnectEvent );
if ( server.isObsolete() )
{
// do not perform any actions if the user has already moved
return;
}
ServerInfo def = con.updateAndGetNextServer( server.getInfo() );
if ( def != null )
{
server.setObsolete( true );
con.connectNow( def, ServerConnectEvent.Reason.SERVER_DOWN_REDIRECT );
con.sendMessage( bungee.getTranslation( "server_went_down", def.getName() ) );
} else
{
con.disconnect( bungee.getTranslation( "lost_connection" ) );
}
ServerDisconnectEvent serverDisconnectEvent = new ServerDisconnectEvent( con, server.getInfo() );
bungee.getPluginManager().callEvent( serverDisconnectEvent );
}
@Override