From 2601fea84f16834bb6fa7135c8637f6ba97e9438 Mon Sep 17 00:00:00 2001 From: games647 Date: Sat, 6 Jun 2020 16:29:52 +0200 Subject: [PATCH] Drop no longer needed uuid getter --- CHANGELOG.md | 2 ++ .../fastlogin/bungee/listener/ConnectListener.java | 13 ------------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7049d90d..d1ac62cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ### 1.11 +* TODO: Replace reflection with methodhandles + * Use direct proxies instead of ssl factories for multiple IP-addresses * Remove local address check for multiple IP-addresses * Fix parsing of local IP-addresses 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 07c14cc8..5881fcf8 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 @@ -42,26 +42,22 @@ public class ConnectListener implements Listener { private final RateLimiter rateLimiter; private static final MethodHandle uniqueIdSetter; - private static final MethodHandle uniqueIdGetter; private static final String UUID_FIELD_NAME = "uniqueId"; static { MethodHandle setHandle = null; - MethodHandle getHandle = null; try { 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(); } uniqueIdSetter = setHandle; - uniqueIdGetter = getHandle; } public ConnectListener(FastLoginBungee plugin, RateLimiter rateLimiter) { @@ -137,15 +133,6 @@ public class ConnectListener implements Listener { String format = "Overridden UUID from {} to {} (based of {}) on {}"; plugin.getLog().info(format, oldPremiumId, offlineUUID, username, connection); - - // check if the field was actually set correctly - UUID offlineResult = (UUID) uniqueIdGetter.invokeExact(connection); - UUID connectionResult = connection.getUniqueId(); - if (!offlineUUID.equals(offlineResult) - || !offlineUUID.equals(connectionResult)) { - throw new RuntimeException("Inconsistent UUIDs: expected " + offlineUUID - + " got (Reflection, Connection)" + offlineResult + " and " + connection); - } } catch (Exception ex) { plugin.getLog().error("Failed to set offline uuid of {}", username, ex); } catch (Throwable throwable) {