mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-30 10:47:33 +02:00
@ -45,7 +45,9 @@ public class ConnectionListener implements Listener {
|
|||||||
// cases: Paper (firing BungeeCord message before PlayerJoinEvent) or not running BungeeCord and already
|
// cases: Paper (firing BungeeCord message before PlayerJoinEvent) or not running BungeeCord and already
|
||||||
// having the login session from the login process
|
// having the login session from the login process
|
||||||
BukkitLoginSession session = plugin.getSession(player.getAddress());
|
BukkitLoginSession session = plugin.getSession(player.getAddress());
|
||||||
if (session != null) {
|
if (session == null) {
|
||||||
|
plugin.getLog().info("No on-going login session for player: {}", player);
|
||||||
|
} else {
|
||||||
Runnable forceLoginTask = new ForceLoginTask(plugin.getCore(), player, session);
|
Runnable forceLoginTask = new ForceLoginTask(plugin.getCore(), player, session);
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, forceLoginTask);
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, forceLoginTask);
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,7 @@ public class ConnectListener implements Listener {
|
|||||||
//bungeecord will do this automatically so override it on disabled option
|
//bungeecord will do this automatically so override it on disabled option
|
||||||
if (!plugin.getCore().getConfig().get("premiumUuid", true)) {
|
if (!plugin.getCore().getConfig().get("premiumUuid", true)) {
|
||||||
try {
|
try {
|
||||||
|
UUID oldPremiumId = connection.getUniqueId();
|
||||||
UUID offlineUUID = UUIDAdapter.generateOfflineId(username);
|
UUID offlineUUID = UUIDAdapter.generateOfflineId(username);
|
||||||
|
|
||||||
// BungeeCord only allows setting the UUID in PreLogin events and before requesting online mode
|
// BungeeCord only allows setting the UUID in PreLogin events and before requesting online mode
|
||||||
@ -90,6 +91,8 @@ public class ConnectListener implements Listener {
|
|||||||
Field idField = InitialHandler.class.getDeclaredField("uniqueId");
|
Field idField = InitialHandler.class.getDeclaredField("uniqueId");
|
||||||
idField.setAccessible(true);
|
idField.setAccessible(true);
|
||||||
idField.set(connection, offlineUUID);
|
idField.set(connection, offlineUUID);
|
||||||
|
|
||||||
|
plugin.getLog().info("Overriding UUID to {} from {} on {}", offlineUUID, oldPremiumId, connection);
|
||||||
} catch (NoSuchFieldException | IllegalAccessException ex) {
|
} catch (NoSuchFieldException | IllegalAccessException ex) {
|
||||||
plugin.getLog().error("Failed to set offline uuid of {}", username, ex);
|
plugin.getLog().error("Failed to set offline uuid of {}", username, ex);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user