diff --git a/src/main/java/fr/xephi/authme/command/executable/register/RegisterCommand.java b/src/main/java/fr/xephi/authme/command/executable/register/RegisterCommand.java index 0aa3e31b1..df4f4501b 100644 --- a/src/main/java/fr/xephi/authme/command/executable/register/RegisterCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/register/RegisterCommand.java @@ -29,7 +29,7 @@ public class RegisterCommand extends ExecutableCommand { // Make sure the command arguments are valid final Player player = (Player) sender; - if (arguments.isEmpty() || (Settings.getEnablePasswordVerifier && arguments.size() < 2)) { + if (arguments.isEmpty() || (Settings.enablePasswordConfirmation && arguments.size() < 2)) { m.send(player, MessageKey.USAGE_REGISTER); return; } @@ -49,7 +49,7 @@ public class RegisterCommand extends ExecutableCommand { management.performRegister(player, thePass, email); return; } - if (arguments.size() > 1 && Settings.getEnablePasswordVerifier) { + if (arguments.size() > 1 && Settings.enablePasswordConfirmation) { if (!arguments.get(0).equals(arguments.get(1))) { m.send(player, MessageKey.PASSWORD_MATCH_ERROR); return; diff --git a/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java index e95d3a312..b9c2859bc 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java @@ -107,7 +107,8 @@ public class AsynchronousJoin { }); } - if (!Settings.noTeleport) + + if (!Settings.noTeleport) { if (Settings.isTeleportToSpawnEnabled || (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName()))) { sched.scheduleSyncDelayedTask(plugin, new Runnable() { @@ -117,26 +118,32 @@ public class AsynchronousJoin { plugin.getServer().getPluginManager().callEvent(tpEvent); if (!tpEvent.isCancelled()) { if (player.isOnline() && tpEvent.getTo() != null) { - if (tpEvent.getTo().getWorld() != null) + if (tpEvent.getTo().getWorld() != null) { player.teleport(tpEvent.getTo()); + } } } } }); } + } + placePlayerSafely(player, spawnLoc); LimboCache.getInstance().updateLimboPlayer(player); + // protect inventory if (Settings.protectInventoryBeforeLogInEnabled && plugin.inventoryProtector != null) { ProtectInventoryEvent ev = new ProtectInventoryEvent(player); plugin.getServer().getPluginManager().callEvent(ev); if (ev.isCancelled()) { plugin.inventoryProtector.sendInventoryPacket(player); - if (!Settings.noConsoleSpam) + if (!Settings.noConsoleSpam) { ConsoleLogger.info("ProtectInventoryEvent has been cancelled for " + player.getName() + " ..."); + } } } + } else { if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin) { sched.scheduleSyncDelayedTask(plugin, new Runnable() { @@ -155,7 +162,8 @@ public class AsynchronousJoin { if (!Settings.isForcedRegistrationEnabled) { return; } - if (!Settings.noTeleport) + + if (!Settings.noTeleport) { if (!needFirstSpawn() && Settings.isTeleportToSpawnEnabled || (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName()))) { sched.scheduleSyncDelayedTask(plugin, new Runnable() { @@ -165,29 +173,26 @@ public class AsynchronousJoin { plugin.getServer().getPluginManager().callEvent(tpEvent); if (!tpEvent.isCancelled()) { if (player.isOnline() && tpEvent.getTo() != null) { - if (tpEvent.getTo().getWorld() != null) + if (tpEvent.getTo().getWorld() != null) { player.teleport(tpEvent.getTo()); + } } } } }); } + } } if (!LimboCache.getInstance().hasLimboPlayer(name)) { LimboCache.getInstance().addLimboPlayer(player); } + Utils.setGroup(player, isAuthAvailable ? GroupType.NOTLOGGEDIN : GroupType.UNREGISTERED); final int timeOut = Settings.getRegistrationTimeout * 20; - int msgInterval = Settings.getWarnMessageInterval; - if (timeOut > 0) { - BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), timeOut); - LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); - } - Utils.setGroup(player, isAuthAvailable ? GroupType.NOTLOGGEDIN : GroupType.UNREGISTERED); sched.scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() { @@ -205,11 +210,24 @@ public class AsynchronousJoin { player.performCommand("motd"); } if (Settings.applyBlindEffect) { - player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, timeOut, 2)); + int blindTimeOut; + // Allow infinite blindness effect + if(timeOut < 0) { + blindTimeOut = 99999; + } else { + blindTimeOut = timeOut; + } + player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, blindTimeOut, 2)); } } }); + + int msgInterval = Settings.getWarnMessageInterval; + if (timeOut > 0) { + BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), timeOut); + LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); + } if (Settings.isSessionsEnabled && isAuthAvailable && (PlayerCache.getInstance().isAuthenticated(name) || database.isLogged(name))) { if (plugin.sessions.containsKey(name)) { diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index ba0496a05..98d5b38c8 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -67,7 +67,7 @@ public final class Settings { isForceSingleSessionEnabled, isForceSpawnLocOnJoinEnabled, isSaveQuitLocationEnabled, isForceSurvivalModeEnabled, isResetInventoryIfCreative, isCachingEnabled, - isKickOnWrongPasswordEnabled, getEnablePasswordVerifier, + isKickOnWrongPasswordEnabled, enablePasswordConfirmation, protectInventoryBeforeLogInEnabled, isBackupActivated, isBackupOnStart, isBackupOnStop, isStopEnabled, reloadSupport, rakamakUseIp, noConsoleSpam, removePassword, displayOtherAccounts, @@ -202,7 +202,7 @@ public final class Settings { } getRegisteredGroup = configFile.getString("GroupOptions.RegisteredPlayerGroup", ""); - getEnablePasswordVerifier = configFile.getBoolean("settings.restrictions.enablePasswordVerifier", true); + enablePasswordConfirmation = configFile.getBoolean("settings.restrictions.enablePasswordConfirmation", true); protectInventoryBeforeLogInEnabled = configFile.getBoolean("settings.restrictions.ProtectInventoryBeforeLogIn", true); plugin.checkProtocolLib(); @@ -581,6 +581,14 @@ public final class Settings { set("settings.useWelcomeMessage", true); changes = true; } + if (!contains("settings.restrictions.enablePasswordConfirmation")) { + set("settings.restrictions.enablePasswordConfirmation", true); + changes = true; + } + if (contains("settings.restrictions.enablePasswordVerifier")) { + set("settings.restrictions.enablePasswordVerifier", null); + changes = true; + } if (!contains("settings.security.unsafePasswords")) { List str = new ArrayList<>(); str.add("123456");