Skip to content

Commit

Permalink
Fix player reconnection to servers after quit. Mark server as obsolet…
Browse files Browse the repository at this point in the history
…e earlier to avoid unnecessary packets from backend while switching servers
  • Loading branch information
Leymooo committed Jul 26, 2024
1 parent e181683 commit a40af99
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions proxy/src/main/java/net/md_5/bungee/ServerConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public void disconnect(BaseComponent... reason)
{
Preconditions.checkArgument( reason.length == 0, "Server cannot have disconnect reason" );

isObsolete = true;
ch.close();
}

Expand Down
9 changes: 5 additions & 4 deletions proxy/src/main/java/net/md_5/bungee/ServerConnector.java
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@ public static void handleLogin(ProxyServer bungee, ChannelWrapper ch, UserConnec
user.getForgeClientHandler().setHandshakeComplete();
}

if ( user.getServer() != null && user.getPendingConnection().getVersion() < ProtocolConstants.MINECRAFT_1_20_2 ) //BotFilter
{
user.getServer().setObsolete( true ); //BotFilter
}

if ( user.isNeedLogin() || user.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_16 ) //BotFilter
{
// Once again, first connection
Expand Down Expand Up @@ -287,10 +292,6 @@ public static void handleLogin(ProxyServer bungee, ChannelWrapper ch, UserConnec
user.setDimension( login.getDimension() );
} else
{
if ( user.getServer() != null ) //BotFilter
{
user.getServer().setObsolete( true ); //BotFilter
}
user.getTabListHandler().onServerChange();

Scoreboard serverScoreboard = user.getServerSentScoreboard();
Expand Down

0 comments on commit a40af99

Please sign in to comment.