Skip to content

Commit

Permalink
Rollback CONFIG handler on server switch
Browse files Browse the repository at this point in the history
  • Loading branch information
UserNugget committed Dec 29, 2023
1 parent 9c09a98 commit 6bc395a
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.proxy.connection.MinecraftConnection;
import com.velocitypowered.proxy.connection.client.ClientConfigSessionHandler;
import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
import com.velocitypowered.proxy.protocol.StateRegistry;
import com.velocitypowered.proxy.protocol.packet.LegacyPlayerListItem;
Expand Down Expand Up @@ -277,10 +278,10 @@ private void deject() {
}

private void sendToRegisteredServer(RegisteredServer server) {
this.connection.eventLoop().execute(() -> {
this.connection.setState(StateRegistry.PLAY);
this.player.createConnectionRequest(server).fireAndForget();
});
this.connection.setState(StateRegistry.PLAY);
this.connection.addSessionHandler(StateRegistry.CONFIG,
new ClientConfigSessionHandler(this.plugin.getServer(), this.player));
this.player.createConnectionRequest(server).fireAndForget();
}

@Override
Expand Down

0 comments on commit 6bc395a

Please sign in to comment.