diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 0e5915e1..8eb947a7 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -203,7 +203,7 @@ public class AuthMePlayerListener implements Listener { // 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 - @EventHandler(priority = EventPriority.LOW) + @EventHandler(priority = EventPriority.LOWEST) public void onPlayerLogin(PlayerLoginEvent event) { final Player player = event.getPlayer(); if (Utils.isUnrestricted(player)) { @@ -216,14 +216,18 @@ public class AuthMePlayerListener implements Listener { final String name = player.getName(); final String lowerName = name.toLowerCase(); - final PlayerAuth auth = dataSource.getAuth(player.getName()); - final boolean isAuthAvailable = (auth != null); try { + // Fast stuff 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.checkKickNonRegistered(isAuthAvailable); - onJoinVerifier.checkIsValidName(name); onJoinVerifier.checkNameCasing(player, auth); onJoinVerifier.checkPlayerCountry(isAuthAvailable, event); } catch (FailedVerificationException e) {