use of com.github.games647.fastlogin.bungee.task.AsyncPremiumCheck in project FastLogin by games647.
the class ConnectListener method onPreLogin.
@EventHandler
public void onPreLogin(PreLoginEvent preLoginEvent) {
PendingConnection connection = preLoginEvent.getConnection();
if (preLoginEvent.isCancelled()) {
return;
}
if (!rateLimiter.tryAcquire()) {
plugin.getLog().warn("Simple Anti-Bot join limit - Ignoring {}", connection);
return;
}
String username = connection.getName();
plugin.getLog().info("Incoming login request for {} from {}", username, connection.getSocketAddress());
preLoginEvent.registerIntent(plugin);
Runnable asyncPremiumCheck = new AsyncPremiumCheck(plugin, preLoginEvent, connection, username);
plugin.getScheduler().runAsync(asyncPremiumCheck);
}
use of com.github.games647.fastlogin.bungee.task.AsyncPremiumCheck in project FastLogin by games647.
the class ConnectListener method onPreLogin.
@Subscribe
public void onPreLogin(PreLoginEvent preLoginEvent, Continuation continuation) {
if (!preLoginEvent.getResult().isAllowed()) {
return;
}
InboundConnection connection = preLoginEvent.getConnection();
if (!rateLimiter.tryAcquire()) {
plugin.getLog().warn("Simple Anti-Bot join limit - Ignoring {}", connection);
return;
}
String username = preLoginEvent.getUsername();
plugin.getLog().info("Incoming login request for {} from {}", username, connection.getRemoteAddress());
Runnable asyncPremiumCheck = new AsyncPremiumCheck(plugin, connection, username, continuation, preLoginEvent);
plugin.getScheduler().runAsync(asyncPremiumCheck);
}
Aggregations