diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index ec0368a6e..59e01376a 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -23,7 +23,6 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.PlayerBedEnterEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerDropItemEvent; @@ -195,34 +194,10 @@ public class AuthMePlayerListener implements Listener { management.performJoin(player); } - // Note ljacqu 20160528: AsyncPlayerPreLoginEvent is not fired by all servers in offline mode + // Note: AsyncPlayerPreLoginEvent is not fired by all servers in offline mode // e.g. CraftBukkit does not. So we need to run crucial things in onPlayerLogin, too - - // Note sgdc3 20160619: No performance improvements if we do the same thing on the Sync method - // let's try to remove this, about the single session issue, - // i tried to use the low priority to the sync handler - - /* - @EventHandler(priority = EventPriority.HIGHEST) - public void onPreLogin(AsyncPlayerPreLoginEvent event) { - final String name = event.getName().toLowerCase(); - //final boolean isAuthAvailable = dataSource.isAuthAvailable(event.getName()); - - try { - // Potential performance improvement: make checkAntiBot not require `isAuthAvailable` info and use - // "checkKickNonRegistered" as last -> no need to query the DB before checking antibot / name - // onJoinVerifier.checkAntibot(name, isAuthAvailable); - // onJoinVerifier.checkKickNonRegistered(isAuthAvailable); - // onJoinVerifier.checkIsValidName(name); - // Note #760: Single session must be checked here - checking with PlayerLoginEvent is too late and - // the first connection will have been kicked. This means this feature doesn't work on CraftBukkit. - onJoinVerifier.checkSingleSession(name); - } catch (FailedVerificationException e) { - event.setKickMessage(m.retrieveSingle(e.getReason(), e.getArgs())); - event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER); - } - } - */ + // 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) public void onPlayerLogin(PlayerLoginEvent event) { diff --git a/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java b/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java index 44f0fd0b4..9c792fe66 100644 --- a/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java @@ -13,7 +13,6 @@ import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.security.PasswordSecurity; import fr.xephi.authme.security.crypts.HashedPassword; import fr.xephi.authme.security.crypts.TwoFactor; -import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.EmailSettings; import fr.xephi.authme.settings.properties.RegistrationSettings; import fr.xephi.authme.settings.properties.RestrictionSettings; @@ -159,10 +158,7 @@ public class AsyncRegister implements AsynchronousProcess { return; } - if (!Settings.forceRegLogin && autoLogin) { - //PlayerCache.getInstance().addPlayer(auth); - //database.setLogged(name); - // TODO: check this... + if (!service.getProperty(RegistrationSettings.FORCE_LOGIN_AFTER_REGISTER) && autoLogin) { plugin.getManagement().performLogin(player, "dontneed", true); } syncProcessManager.processSyncPasswordRegister(player); diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 235801558..6e8430010 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -3,7 +3,6 @@ package fr.xephi.authme.settings; import fr.xephi.authme.AuthMe; import fr.xephi.authme.settings.domain.Property; import fr.xephi.authme.settings.properties.PluginSettings; -import fr.xephi.authme.settings.properties.RegistrationSettings; import fr.xephi.authme.settings.properties.RestrictionSettings; import fr.xephi.authme.settings.properties.SecuritySettings; import org.bukkit.configuration.file.FileConfiguration; @@ -25,7 +24,6 @@ public final class Settings { public static boolean protectInventoryBeforeLogInEnabled; public static boolean isStopEnabled; public static boolean reloadSupport; - public static boolean forceRegLogin; public static boolean noTeleport; public static boolean isRemoveSpeedEnabled; public static String getUnloggedinGroup; @@ -64,7 +62,6 @@ public final class Settings { isStopEnabled = configFile.getBoolean("Security.SQLProblem.stopServer", true); reloadSupport = configFile.getBoolean("Security.ReloadCommand.useReloadCommandSupport", true); defaultWorld = configFile.getString("Purge.defaultWorld", "world"); - forceRegLogin = load(RegistrationSettings.FORCE_LOGIN_AFTER_REGISTER); noTeleport = load(RestrictionSettings.NO_TELEPORT); crazyloginFileName = configFile.getString("Converter.CrazyLogin.fileName", "accounts.db"); }