Skip to content

Commit

Permalink
Ensure the client brand is sent to the backend when exiting limbo (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
metabrixkt authored Jan 15, 2025
1 parent 2bb3634 commit f779f2d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public class LoginTasksQueue {
private static final BiConsumer<Object, MinecraftConnection> MC_CONNECTION_SETTER;
private static final MethodHandle CONNECT_TO_INITIAL_SERVER_METHOD;
private static final MethodHandle SET_CLIENT_BRAND;
private static final BiConsumer<ClientConfigSessionHandler, String> BRAND_CHANNEL_SETTER;
public static final BiConsumer<ClientConfigSessionHandler, String> BRAND_CHANNEL_SETTER;

private final LimboAPI plugin;
private final Object handler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import net.elytrium.limboapi.api.protocol.packets.data.AbilityFlags;
import net.elytrium.limboapi.api.protocol.packets.data.MapData;
import net.elytrium.limboapi.api.protocol.packets.data.MapPalette;
import net.elytrium.limboapi.injection.login.LoginTasksQueue;
import net.elytrium.limboapi.protocol.packets.s2c.ChangeGameStatePacket;
import net.elytrium.limboapi.protocol.packets.s2c.MapDataPacket;
import net.elytrium.limboapi.protocol.packets.s2c.PlayerAbilitiesPacket;
Expand Down Expand Up @@ -299,8 +300,9 @@ private void sendToRegisteredServer(RegisteredServer server) {
if (this.connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_20_2) >= 0) {
this.sessionHandler.disconnectToConfig(() -> {
// Rollback original CONFIG handler
this.connection.setActiveSessionHandler(StateRegistry.CONFIG,
new ClientConfigSessionHandler(this.plugin.getServer(), this.player));
ClientConfigSessionHandler handler = new ClientConfigSessionHandler(this.plugin.getServer(), this.player);
LoginTasksQueue.BRAND_CHANNEL_SETTER.accept(handler, "minecraft:brand");
this.connection.setActiveSessionHandler(StateRegistry.CONFIG, handler);
this.player.createConnectionRequest(server).fireAndForget();
});
} else {
Expand Down

0 comments on commit f779f2d

Please sign in to comment.