mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2025-02-08 07:51:33 +01:00
should fix #831 and enhance performance
This commit is contained in:
parent
09e4124ebb
commit
361039f946
@ -203,7 +203,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
// We have no performance improvements if we do the same thing on two different events
|
// We have no performance improvements if we do the same thing on two different events
|
||||||
// Important: the single session feature works if we use the low priority to the sync handler
|
// Important: the single session feature works if we use the low priority to the sync handler
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onPlayerLogin(PlayerLoginEvent event) {
|
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
if (Utils.isUnrestricted(player)) {
|
if (Utils.isUnrestricted(player)) {
|
||||||
@ -216,14 +216,18 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
|
|
||||||
final String name = player.getName();
|
final String name = player.getName();
|
||||||
final String lowerName = name.toLowerCase();
|
final String lowerName = name.toLowerCase();
|
||||||
final PlayerAuth auth = dataSource.getAuth(player.getName());
|
|
||||||
final boolean isAuthAvailable = (auth != null);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// Fast stuff
|
||||||
onJoinVerifier.checkSingleSession(lowerName);
|
onJoinVerifier.checkSingleSession(lowerName);
|
||||||
|
onJoinVerifier.checkIsValidName(name);
|
||||||
|
|
||||||
|
// Get the auth later as this may cause the single session check to fail
|
||||||
|
// Slow stuff
|
||||||
|
final PlayerAuth auth = dataSource.getAuth(player.getName());
|
||||||
|
final boolean isAuthAvailable = (auth != null);
|
||||||
onJoinVerifier.checkAntibot(lowerName, isAuthAvailable);
|
onJoinVerifier.checkAntibot(lowerName, isAuthAvailable);
|
||||||
onJoinVerifier.checkKickNonRegistered(isAuthAvailable);
|
onJoinVerifier.checkKickNonRegistered(isAuthAvailable);
|
||||||
onJoinVerifier.checkIsValidName(name);
|
|
||||||
onJoinVerifier.checkNameCasing(player, auth);
|
onJoinVerifier.checkNameCasing(player, auth);
|
||||||
onJoinVerifier.checkPlayerCountry(isAuthAvailable, event);
|
onJoinVerifier.checkPlayerCountry(isAuthAvailable, event);
|
||||||
} catch (FailedVerificationException e) {
|
} catch (FailedVerificationException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user