You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LimboAPI follows Velocity behavior for configuration phase and reuses the same ClientConfigSessionHandler; or, at least, preserves the brandChannel field.
Proposed fix
diff --git a/plugin/src/main/java/net/elytrium/limboapi/injection/login/LoginTasksQueue.java b/plugin/src/main/java/net/elytrium/limboapi/injection/login/LoginTasksQueue.java
index bc027db..be00a88 100644
--- a/plugin/src/main/java/net/elytrium/limboapi/injection/login/LoginTasksQueue.java+++ b/plugin/src/main/java/net/elytrium/limboapi/injection/login/LoginTasksQueue.java@@ -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;
diff --git a/plugin/src/main/java/net/elytrium/limboapi/server/LimboPlayerImpl.java b/plugin/src/main/java/net/elytrium/limboapi/server/LimboPlayerImpl.java
index f26767f..cc16a49 100644
--- a/plugin/src/main/java/net/elytrium/limboapi/server/LimboPlayerImpl.java+++ b/plugin/src/main/java/net/elytrium/limboapi/server/LimboPlayerImpl.java@@ -43,6 +43,7 @@ import net.elytrium.limboapi.api.protocol.item.ItemComponentMap;
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;
@@ -299,8 +300,9 @@ public class LimboPlayerImpl implements LimboPlayer {
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 {
The bug
Velocity doesn't send the client brand to the backend when reconnecting back from limbo.
Related code in LimboAPI:
LimboAPI/plugin/src/main/java/net/elytrium/limboapi/server/LimboPlayerImpl.java
Lines 301 to 303 in be15850
This happens because Velocity expects
ClientConfigSessionHandler
'sprivate String brandChannel
field to be set inClientConfigSessionHandler#handle(PluginMessageEvent)
during initial configuration — the client sends the brand only during its first configuration that comes right after the login phase. The issue isn't present when changing servers because Velocity reuses the sameClientConfigSessionHandler
after one was created: https://github.com/PaperMC/Velocity/blob/4aa9ee77351531430019b4725427c5d9e5bed913/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java#L397-L399Expected behavior
LimboAPI follows Velocity behavior for configuration phase and reuses the same
ClientConfigSessionHandler
; or, at least, preserves thebrandChannel
field.Proposed fix
going to PR that soon
Server info
Additional info
This seems to have been a bug ever since the configuration phase was added in Minecraft 1.20.2.
The text was updated successfully, but these errors were encountered: