forked from TuxCoding/FastLogin
@@ -42,7 +42,8 @@ public class AsyncScheduler extends AbstractAsyncScheduler {
|
|||||||
|
|
||||||
public AsyncScheduler(Logger logger, Executor processingPool) {
|
public AsyncScheduler(Logger logger, Executor processingPool) {
|
||||||
super(logger, 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
|
@Override
|
||||||
|
@@ -46,6 +46,7 @@ import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
|||||||
import com.velocitypowered.api.event.proxy.ProxyShutdownEvent;
|
import com.velocitypowered.api.event.proxy.ProxyShutdownEvent;
|
||||||
import com.velocitypowered.api.plugin.Plugin;
|
import com.velocitypowered.api.plugin.Plugin;
|
||||||
import com.velocitypowered.api.plugin.annotation.DataDirectory;
|
import com.velocitypowered.api.plugin.annotation.DataDirectory;
|
||||||
|
import com.velocitypowered.api.proxy.InboundConnection;
|
||||||
import com.velocitypowered.api.proxy.Player;
|
import com.velocitypowered.api.proxy.Player;
|
||||||
import com.velocitypowered.api.proxy.ProxyServer;
|
import com.velocitypowered.api.proxy.ProxyServer;
|
||||||
import com.velocitypowered.api.proxy.messages.ChannelMessageSink;
|
import com.velocitypowered.api.proxy.messages.ChannelMessageSink;
|
||||||
@@ -57,7 +58,6 @@ import org.geysermc.geyser.GeyserImpl;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.InetSocketAddress;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
@@ -75,7 +75,7 @@ public class FastLoginVelocity implements PlatformPlugin<CommandSource> {
|
|||||||
private final ProxyServer server;
|
private final ProxyServer server;
|
||||||
private final Path dataDirectory;
|
private final Path dataDirectory;
|
||||||
private final Logger logger;
|
private final Logger logger;
|
||||||
private final ConcurrentMap<InetSocketAddress, VelocityLoginSession> session = new MapMaker().weakKeys().makeMap();
|
private final ConcurrentMap<InboundConnection, VelocityLoginSession> session = new MapMaker().weakKeys().makeMap();
|
||||||
private static final String PROXY_ID_FILE = "proxyId.txt";
|
private static final String PROXY_ID_FILE = "proxyId.txt";
|
||||||
|
|
||||||
private FastLoginCore<Player, CommandSource, FastLoginVelocity> core;
|
private FastLoginCore<Player, CommandSource, FastLoginVelocity> core;
|
||||||
@@ -175,7 +175,7 @@ public class FastLoginVelocity implements PlatformPlugin<CommandSource> {
|
|||||||
return core;
|
return core;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConcurrentMap<InetSocketAddress, VelocityLoginSession> getSession() {
|
public ConcurrentMap<InboundConnection, VelocityLoginSession> getSession() {
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -66,4 +66,8 @@ public class VelocityLoginSource implements LoginSource {
|
|||||||
public InetSocketAddress getAddress() {
|
public InetSocketAddress getAddress() {
|
||||||
return connection.getRemoteAddress();
|
return connection.getRemoteAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InboundConnection getConnection() {
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -119,9 +119,9 @@ public class ConnectListener {
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onGameProfileRequest(GameProfileRequestEvent event) {
|
public void onGameProfileRequest(GameProfileRequestEvent event) {
|
||||||
if (event.isOnlineMode()) {
|
if (event.isOnlineMode()) {
|
||||||
LoginSession session = plugin.getSession().get(event.getConnection().getRemoteAddress());
|
LoginSession session = plugin.getSession().get(event.getConnection());
|
||||||
if (session == null) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ public class ConnectListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VelocityLoginSession session = plugin.getSession().get(player.getRemoteAddress());
|
VelocityLoginSession session = plugin.getSession().get(player);
|
||||||
if (session == null) {
|
if (session == null) {
|
||||||
plugin.getLog().info("No active login session found on server connect for {}", player);
|
plugin.getLog().info("No active login session found on server connect for {}", player);
|
||||||
return;
|
return;
|
||||||
@@ -192,6 +192,8 @@ public class ConnectListener {
|
|||||||
public void onDisconnect(DisconnectEvent disconnectEvent) {
|
public void onDisconnect(DisconnectEvent disconnectEvent) {
|
||||||
Player player = disconnectEvent.getPlayer();
|
Player player = disconnectEvent.getPlayer();
|
||||||
plugin.getCore().getPendingConfirms().remove(player.getUniqueId());
|
plugin.getCore().getPendingConfirms().remove(player.getUniqueId());
|
||||||
|
|
||||||
|
plugin.getSession().remove(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -127,7 +127,7 @@ public class PluginMessageListener {
|
|||||||
if (shouldPersist) {
|
if (shouldPersist) {
|
||||||
//bukkit module successfully received and force logged in the user
|
//bukkit module successfully received and force logged in the user
|
||||||
//update only on success to prevent corrupt data
|
//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();
|
StoredProfile playerProfile = loginSession.getProfile();
|
||||||
loginSession.setRegistered(true);
|
loginSession.setRegistered(true);
|
||||||
if (!loginSession.isAlreadySaved()) {
|
if (!loginSession.isAlreadySaved()) {
|
||||||
|
@@ -58,7 +58,7 @@ public class AsyncPremiumCheck extends JoinManagement<Player, CommandSource, Vel
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
plugin.getSession().remove(connection.getRemoteAddress());
|
plugin.getSession().remove(connection);
|
||||||
super.onLogin(username, new VelocityLoginSource(connection, preLoginEvent));
|
super.onLogin(username, new VelocityLoginSource(connection, preLoginEvent));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ public class AsyncPremiumCheck extends JoinManagement<Player, CommandSource, Vel
|
|||||||
String username, boolean registered) {
|
String username, boolean registered) {
|
||||||
source.enableOnlinemode();
|
source.enableOnlinemode();
|
||||||
VelocityLoginSession session = new VelocityLoginSession(username, registered, profile);
|
VelocityLoginSession session = new VelocityLoginSession(username, registered, profile);
|
||||||
plugin.getSession().put(source.getAddress(), session);
|
plugin.getSession().put(source.getConnection(), session);
|
||||||
|
|
||||||
String ip = source.getAddress().getAddress().getHostAddress();
|
String ip = source.getAddress().getAddress().getHostAddress();
|
||||||
plugin.getCore().addLoginAttempt(ip, username);
|
plugin.getCore().addLoginAttempt(ip, username);
|
||||||
@@ -91,6 +91,6 @@ public class AsyncPremiumCheck extends JoinManagement<Player, CommandSource, Vel
|
|||||||
@Override
|
@Override
|
||||||
public void startCrackedSession(VelocityLoginSource source, StoredProfile profile, String username) {
|
public void startCrackedSession(VelocityLoginSource source, StoredProfile profile, String username) {
|
||||||
VelocityLoginSession session = new VelocityLoginSession(username, false, profile);
|
VelocityLoginSession session = new VelocityLoginSession(username, false, profile);
|
||||||
plugin.getSession().put(source.getAddress(), session);
|
plugin.getSession().put(source.getConnection(), session);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -52,7 +52,7 @@ public class FloodgateAuthTask
|
|||||||
@Override
|
@Override
|
||||||
protected void startLogin() {
|
protected void startLogin() {
|
||||||
VelocityLoginSession session = new VelocityLoginSession(player.getUsername(), isRegistered, profile);
|
VelocityLoginSession session = new VelocityLoginSession(player.getUsername(), isRegistered, profile);
|
||||||
core.getPlugin().getSession().put(player.getRemoteAddress(), session);
|
core.getPlugin().getSession().put(player, session);
|
||||||
|
|
||||||
// enable auto login based on the value of 'autoLoginFloodgate' in config.yml
|
// enable auto login based on the value of 'autoLoginFloodgate' in config.yml
|
||||||
boolean forcedOnlineMode = autoLoginFloodgate.equals("true")
|
boolean forcedOnlineMode = autoLoginFloodgate.equals("true")
|
||||||
|
Reference in New Issue
Block a user