mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-30 10:47:33 +02:00
Drop no longer needed uuid getter
This commit is contained in:
@ -1,5 +1,7 @@
|
|||||||
### 1.11
|
### 1.11
|
||||||
|
|
||||||
|
* TODO: Replace reflection with methodhandles
|
||||||
|
|
||||||
* Use direct proxies instead of ssl factories for multiple IP-addresses
|
* Use direct proxies instead of ssl factories for multiple IP-addresses
|
||||||
* Remove local address check for multiple IP-addresses
|
* Remove local address check for multiple IP-addresses
|
||||||
* Fix parsing of local IP-addresses
|
* Fix parsing of local IP-addresses
|
||||||
|
@ -42,26 +42,22 @@ public class ConnectListener implements Listener {
|
|||||||
private final RateLimiter rateLimiter;
|
private final RateLimiter rateLimiter;
|
||||||
|
|
||||||
private static final MethodHandle uniqueIdSetter;
|
private static final MethodHandle uniqueIdSetter;
|
||||||
private static final MethodHandle uniqueIdGetter;
|
|
||||||
|
|
||||||
private static final String UUID_FIELD_NAME = "uniqueId";
|
private static final String UUID_FIELD_NAME = "uniqueId";
|
||||||
|
|
||||||
static {
|
static {
|
||||||
MethodHandle setHandle = null;
|
MethodHandle setHandle = null;
|
||||||
MethodHandle getHandle = null;
|
|
||||||
try {
|
try {
|
||||||
Lookup lookup = MethodHandles.lookup();
|
Lookup lookup = MethodHandles.lookup();
|
||||||
|
|
||||||
Field uuidField = InitialHandler.class.getDeclaredField(UUID_FIELD_NAME);
|
Field uuidField = InitialHandler.class.getDeclaredField(UUID_FIELD_NAME);
|
||||||
uuidField.setAccessible(true);
|
uuidField.setAccessible(true);
|
||||||
setHandle = lookup.unreflectSetter(uuidField);
|
setHandle = lookup.unreflectSetter(uuidField);
|
||||||
getHandle = lookup.unreflectGetter(uuidField);
|
|
||||||
} catch (ReflectiveOperationException reflectiveOperationException) {
|
} catch (ReflectiveOperationException reflectiveOperationException) {
|
||||||
reflectiveOperationException.printStackTrace();
|
reflectiveOperationException.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
uniqueIdSetter = setHandle;
|
uniqueIdSetter = setHandle;
|
||||||
uniqueIdGetter = getHandle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConnectListener(FastLoginBungee plugin, RateLimiter rateLimiter) {
|
public ConnectListener(FastLoginBungee plugin, RateLimiter rateLimiter) {
|
||||||
@ -137,15 +133,6 @@ public class ConnectListener implements Listener {
|
|||||||
|
|
||||||
String format = "Overridden UUID from {} to {} (based of {}) on {}";
|
String format = "Overridden UUID from {} to {} (based of {}) on {}";
|
||||||
plugin.getLog().info(format, oldPremiumId, offlineUUID, username, connection);
|
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) {
|
} catch (Exception ex) {
|
||||||
plugin.getLog().error("Failed to set offline uuid of {}", username, ex);
|
plugin.getLog().error("Failed to set offline uuid of {}", username, ex);
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
|
Reference in New Issue
Block a user