From f82c28a964c32f60f2f53f6a9e802ded9794262c Mon Sep 17 00:00:00 2001 From: Ahmad Nasser <106764307+AhmadNasser04@users.noreply.github.com> Date: Fri, 3 Jul 2026 03:38:39 +0300 Subject: [PATCH] Fire LoginEvent with server ID hash instead of deprecated constructor --- .../elytrium/limboapi/injection/login/LoginTasksQueue.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 c312718f..748c8d12 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 @@ -88,6 +88,7 @@ public class LoginTasksQueue { private static final MethodHandle INITIAL_CONNECT_SESSION_HANDLER_CONSTRUCTOR; private static final BiConsumer MC_CONNECTION_SETTER; private static final MethodHandle CONNECT_TO_INITIAL_SERVER_METHOD; + private static final MethodHandle SERVER_ID_HASH_GETTER; private static final MethodHandle SET_CLIENT_BRAND; public static final BiConsumer BRAND_CHANNEL_SETTER; @@ -211,7 +212,8 @@ private void initialize(MinecraftConnection connection) throws Throwable { } Logger logger = LimboAPI.getLogger(); - this.server.getEventManager().fire(new LoginEvent(this.player)).thenAcceptAsync(event -> { + String serverIdHash = (String) SERVER_ID_HASH_GETTER.invokeExact((AuthSessionHandler) this.handler); + this.server.getEventManager().fire(new LoginEvent(this.player, serverIdHash)).thenAcceptAsync(event -> { if (connection.isClosed()) { // The player was disconnected. this.server.getEventManager().fireAndForget(new DisconnectEvent(this.player, DisconnectEvent.LoginStatus.CANCELLED_BY_USER_BEFORE_COMPLETE)); @@ -306,6 +308,9 @@ private void connectToServer(Logger logger, ConnectedPlayer player, MinecraftCon CONNECT_TO_INITIAL_SERVER_METHOD = MethodHandles.privateLookupIn(AuthSessionHandler.class, MethodHandles.lookup()) .findVirtual(AuthSessionHandler.class, "connectToInitialServer", MethodType.methodType(CompletableFuture.class, ConnectedPlayer.class)); + SERVER_ID_HASH_GETTER = MethodHandles.privateLookupIn(AuthSessionHandler.class, MethodHandles.lookup()) + .findGetter(AuthSessionHandler.class, "serverIdHash", String.class); + Field mcConnectionField = AuthSessionHandler.class.getDeclaredField("mcConnection"); mcConnectionField.setAccessible(true); MC_CONNECTION_SETTER = LambdaUtil.setterOf(mcConnectionField);