mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-25 10:07:35 +01:00
commit
8aed29f988
@ -106,7 +106,18 @@ public class AuthMe extends JavaPlugin {
|
|||||||
public ConcurrentHashMap<String, String> cap = new ConcurrentHashMap<>();
|
public ConcurrentHashMap<String, String> cap = new ConcurrentHashMap<>();
|
||||||
public ConcurrentHashMap<String, String> realIp = new ConcurrentHashMap<>();
|
public ConcurrentHashMap<String, String> realIp = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public static AuthMe getInstance() {
|
// In case we need to cache PlayerAuths, prevent connection before it's done
|
||||||
|
private boolean canConnect = true;
|
||||||
|
|
||||||
|
public boolean isCanConnect() {
|
||||||
|
return canConnect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCanConnect(boolean canConnect) {
|
||||||
|
this.canConnect = canConnect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AuthMe getInstance() {
|
||||||
return authme;
|
return authme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,9 +20,10 @@ public class CacheDataSource implements DataSource {
|
|||||||
private final ExecutorService exec;
|
private final ExecutorService exec;
|
||||||
private final ConcurrentHashMap<String, PlayerAuth> cache = new ConcurrentHashMap<>();
|
private final ConcurrentHashMap<String, PlayerAuth> cache = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public CacheDataSource(AuthMe pl, DataSource src) {
|
public CacheDataSource(final AuthMe pl, DataSource src) {
|
||||||
this.source = src;
|
this.source = src;
|
||||||
this.exec = Executors.newCachedThreadPool();
|
this.exec = Executors.newCachedThreadPool();
|
||||||
|
pl.setCanConnect(false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We need to load all players in cache ... It will took more time to
|
* We need to load all players in cache ... It will took more time to
|
||||||
@ -35,6 +36,7 @@ public class CacheDataSource implements DataSource {
|
|||||||
for (PlayerAuth auth : source.getAllAuths()) {
|
for (PlayerAuth auth : source.getAllAuths()) {
|
||||||
cache.put(auth.getNickname().toLowerCase(), auth);
|
cache.put(auth.getNickname().toLowerCase(), auth);
|
||||||
}
|
}
|
||||||
|
pl.setCanConnect(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,21 @@ public class AsyncronousJoin {
|
|||||||
plugin.ess.getUser(player).setSocialSpyEnabled(false);
|
plugin.ess.getUser(player).setSocialSpyEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!plugin.isCanConnect())
|
||||||
|
{
|
||||||
|
final GameMode gM = AuthMePlayerListener.gameMode.get(name);
|
||||||
|
sched.scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
AuthMePlayerListener.causeByAuthMe.putIfAbsent(name, true);
|
||||||
|
player.setGameMode(gM);
|
||||||
|
player.kickPlayer("Server is loading, please wait before joining!");
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
final String ip = plugin.getIP(player);
|
final String ip = plugin.getIP(player);
|
||||||
if (Settings.isAllowRestrictedIp && !Settings.getRestrictedIp(name, ip)) {
|
if (Settings.isAllowRestrictedIp && !Settings.getRestrictedIp(name, ip)) {
|
||||||
final GameMode gM = AuthMePlayerListener.gameMode.get(name);
|
final GameMode gM = AuthMePlayerListener.gameMode.get(name);
|
||||||
|
Loading…
Reference in New Issue
Block a user