From b41d56f835ba1a6a1c27d7f99ebdd7ec2c10e0e4 Mon Sep 17 00:00:00 2001 From: games647 Date: Tue, 19 May 2020 09:57:39 +0200 Subject: [PATCH] Fix reflection access --- .../fastlogin/bungee/listener/ConnectListener.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java index e743c38d..8c11cdad 100644 --- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java +++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java @@ -13,6 +13,7 @@ import com.google.common.base.Throwables; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles.Lookup; +import java.lang.reflect.Field; import java.util.UUID; import net.md_5.bungee.api.connection.PendingConnection; @@ -49,9 +50,12 @@ public class ConnectListener implements Listener { MethodHandle setHandle = null; MethodHandle getHandle = null; try { - final Lookup lookup = MethodHandles.lookup(); - setHandle = lookup.findSetter(InitialHandler.class, UUID_FIELD_NAME, UUID.class); - getHandle = lookup.findGetter(InitialHandler.class, UUID_FIELD_NAME, UUID.class); + Lookup lookup = MethodHandles.lookup(); + + Field uuidField = InitialHandler.class.getDeclaredField(UUID_FIELD_NAME); + uuidField.setAccessible(true); + setHandle = lookup.unreflectSetter(uuidField); + getHandle = lookup.unreflectGetter(uuidField); } catch (ReflectiveOperationException reflectiveOperationException) { reflectiveOperationException.printStackTrace(); }