diff --git a/core/src/main/java/com/github/games647/fastlogin/core/scheduler/AsyncScheduler.java b/core/src/main/java/com/github/games647/fastlogin/core/scheduler/AsyncScheduler.java index 57c7d40e..f438a84f 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/scheduler/AsyncScheduler.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/scheduler/AsyncScheduler.java @@ -42,7 +42,8 @@ public class AsyncScheduler extends AbstractAsyncScheduler { public AsyncScheduler(Logger logger, Executor processingPool) { super(logger, processingPool); - logger.info("Using legacy platform scheduler for using an older Java version"); + logger.info("Using legacy platform scheduler for using an older Java version. " + + "Upgrade Java to 21+ for improved performance"); } @Override diff --git a/velocity/src/main/java/com/github/games647/fastlogin/velocity/FastLoginVelocity.java b/velocity/src/main/java/com/github/games647/fastlogin/velocity/FastLoginVelocity.java index 26217b83..cb009dfe 100644 --- a/velocity/src/main/java/com/github/games647/fastlogin/velocity/FastLoginVelocity.java +++ b/velocity/src/main/java/com/github/games647/fastlogin/velocity/FastLoginVelocity.java @@ -46,6 +46,7 @@ import com.velocitypowered.api.event.proxy.ProxyInitializeEvent; import com.velocitypowered.api.event.proxy.ProxyShutdownEvent; import com.velocitypowered.api.plugin.Plugin; import com.velocitypowered.api.plugin.annotation.DataDirectory; +import com.velocitypowered.api.proxy.InboundConnection; import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.messages.ChannelMessageSink; @@ -57,7 +58,6 @@ import org.geysermc.geyser.GeyserImpl; import org.slf4j.Logger; import java.io.IOException; -import java.net.InetSocketAddress; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; @@ -75,7 +75,7 @@ public class FastLoginVelocity implements PlatformPlugin { private final ProxyServer server; private final Path dataDirectory; private final Logger logger; - private final ConcurrentMap session = new MapMaker().weakKeys().makeMap(); + private final ConcurrentMap session = new MapMaker().weakKeys().makeMap(); private static final String PROXY_ID_FILE = "proxyId.txt"; private FastLoginCore core; @@ -175,7 +175,7 @@ public class FastLoginVelocity implements PlatformPlugin { return core; } - public ConcurrentMap getSession() { + public ConcurrentMap getSession() { return session; } diff --git a/velocity/src/main/java/com/github/games647/fastlogin/velocity/VelocityLoginSource.java b/velocity/src/main/java/com/github/games647/fastlogin/velocity/VelocityLoginSource.java index dfd98acb..16f36d4f 100644 --- a/velocity/src/main/java/com/github/games647/fastlogin/velocity/VelocityLoginSource.java +++ b/velocity/src/main/java/com/github/games647/fastlogin/velocity/VelocityLoginSource.java @@ -66,4 +66,8 @@ public class VelocityLoginSource implements LoginSource { public InetSocketAddress getAddress() { return connection.getRemoteAddress(); } + + public InboundConnection getConnection() { + return connection; + } } diff --git a/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/ConnectListener.java b/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/ConnectListener.java index 90513b23..da49a41f 100644 --- a/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/ConnectListener.java +++ b/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/ConnectListener.java @@ -119,9 +119,9 @@ public class ConnectListener { @Subscribe public void onGameProfileRequest(GameProfileRequestEvent event) { if (event.isOnlineMode()) { - LoginSession session = plugin.getSession().get(event.getConnection().getRemoteAddress()); + LoginSession session = plugin.getSession().get(event.getConnection()); if (session == null) { - plugin.getLog().warn("No active login session found for player {}", event.getUsername()); + plugin.getLog().error("No active login session found for onlinemode player {}", event.getUsername()); return; } @@ -173,7 +173,7 @@ public class ConnectListener { } } - VelocityLoginSession session = plugin.getSession().get(player.getRemoteAddress()); + VelocityLoginSession session = plugin.getSession().get(player); if (session == null) { plugin.getLog().info("No active login session found on server connect for {}", player); return; @@ -192,6 +192,8 @@ public class ConnectListener { public void onDisconnect(DisconnectEvent disconnectEvent) { Player player = disconnectEvent.getPlayer(); plugin.getCore().getPendingConfirms().remove(player.getUniqueId()); + + plugin.getSession().remove(player); } /** diff --git a/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/PluginMessageListener.java b/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/PluginMessageListener.java index 12b19f60..36f916c2 100644 --- a/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/PluginMessageListener.java +++ b/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/PluginMessageListener.java @@ -127,7 +127,7 @@ public class PluginMessageListener { if (shouldPersist) { //bukkit module successfully received and force logged in the user //update only on success to prevent corrupt data - VelocityLoginSession loginSession = plugin.getSession().get(forPlayer.getRemoteAddress()); + VelocityLoginSession loginSession = plugin.getSession().get(forPlayer); StoredProfile playerProfile = loginSession.getProfile(); loginSession.setRegistered(true); if (!loginSession.isAlreadySaved()) { diff --git a/velocity/src/main/java/com/github/games647/fastlogin/velocity/task/AsyncPremiumCheck.java b/velocity/src/main/java/com/github/games647/fastlogin/velocity/task/AsyncPremiumCheck.java index 321afa79..878f6068 100644 --- a/velocity/src/main/java/com/github/games647/fastlogin/velocity/task/AsyncPremiumCheck.java +++ b/velocity/src/main/java/com/github/games647/fastlogin/velocity/task/AsyncPremiumCheck.java @@ -58,7 +58,7 @@ public class AsyncPremiumCheck extends JoinManagement