Skip to content

Commit f779f2d

Browse files
authored
Ensure the client brand is sent to the backend when exiting limbo (#178)
1 parent 2bb3634 commit f779f2d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

plugin/src/main/java/net/elytrium/limboapi/injection/login/LoginTasksQueue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public class LoginTasksQueue {
8989
private static final BiConsumer<Object, MinecraftConnection> MC_CONNECTION_SETTER;
9090
private static final MethodHandle CONNECT_TO_INITIAL_SERVER_METHOD;
9191
private static final MethodHandle SET_CLIENT_BRAND;
92-
private static final BiConsumer<ClientConfigSessionHandler, String> BRAND_CHANNEL_SETTER;
92+
public static final BiConsumer<ClientConfigSessionHandler, String> BRAND_CHANNEL_SETTER;
9393

9494
private final LimboAPI plugin;
9595
private final Object handler;

plugin/src/main/java/net/elytrium/limboapi/server/LimboPlayerImpl.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import net.elytrium.limboapi.api.protocol.packets.data.AbilityFlags;
4444
import net.elytrium.limboapi.api.protocol.packets.data.MapData;
4545
import net.elytrium.limboapi.api.protocol.packets.data.MapPalette;
46+
import net.elytrium.limboapi.injection.login.LoginTasksQueue;
4647
import net.elytrium.limboapi.protocol.packets.s2c.ChangeGameStatePacket;
4748
import net.elytrium.limboapi.protocol.packets.s2c.MapDataPacket;
4849
import net.elytrium.limboapi.protocol.packets.s2c.PlayerAbilitiesPacket;
@@ -299,8 +300,9 @@ private void sendToRegisteredServer(RegisteredServer server) {
299300
if (this.connection.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_20_2) >= 0) {
300301
this.sessionHandler.disconnectToConfig(() -> {
301302
// Rollback original CONFIG handler
302-
this.connection.setActiveSessionHandler(StateRegistry.CONFIG,
303-
new ClientConfigSessionHandler(this.plugin.getServer(), this.player));
303+
ClientConfigSessionHandler handler = new ClientConfigSessionHandler(this.plugin.getServer(), this.player);
304+
LoginTasksQueue.BRAND_CHANNEL_SETTER.accept(handler, "minecraft:brand");
305+
this.connection.setActiveSessionHandler(StateRegistry.CONFIG, handler);
304306
this.player.createConnectionRequest(server).fireAndForget();
305307
});
306308
} else {

0 commit comments

Comments
 (0)