diff --git a/src/main/java/fr/xephi/authme/listener/OnJoinVerifier.java b/src/main/java/fr/xephi/authme/listener/OnJoinVerifier.java index 73bf93e3..6fbee291 100644 --- a/src/main/java/fr/xephi/authme/listener/OnJoinVerifier.java +++ b/src/main/java/fr/xephi/authme/listener/OnJoinVerifier.java @@ -164,7 +164,7 @@ class OnJoinVerifier implements Reloadable { */ public void checkPlayerCountry(boolean isAuthAvailable, PlayerLoginEvent event) throws FailedVerificationException { - if (!isAuthAvailable && settings.getProperty(ProtectionSettings.ENABLE_PROTECTION)) { + if ((!isAuthAvailable || settings.getProperty(ProtectionSettings.ENABLE_PROTECTION_REGISTERED) ) && settings.getProperty(ProtectionSettings.ENABLE_PROTECTION)) { String playerIp = event.getAddress().getHostAddress(); if (!validationService.isCountryAdmitted(playerIp)) { throw new FailedVerificationException(MessageKey.COUNTRY_BANNED_ERROR); diff --git a/src/main/java/fr/xephi/authme/process/quit/AsynchronousQuit.java b/src/main/java/fr/xephi/authme/process/quit/AsynchronousQuit.java index e9373c64..4a2985dc 100644 --- a/src/main/java/fr/xephi/authme/process/quit/AsynchronousQuit.java +++ b/src/main/java/fr/xephi/authme/process/quit/AsynchronousQuit.java @@ -11,7 +11,6 @@ import fr.xephi.authme.process.ProcessService; import fr.xephi.authme.process.SyncProcessManager; import fr.xephi.authme.settings.SpawnLoader; import fr.xephi.authme.settings.properties.RestrictionSettings; -import fr.xephi.authme.util.BukkitService; import fr.xephi.authme.util.Utils; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -41,9 +40,6 @@ public class AsynchronousQuit implements AsynchronousProcess { @Inject private SpawnLoader spawnLoader; - @Inject - private BukkitService bukkitService; - AsynchronousQuit() { } diff --git a/src/main/java/fr/xephi/authme/settings/properties/ProtectionSettings.java b/src/main/java/fr/xephi/authme/settings/properties/ProtectionSettings.java index 312f3f51..49bad830 100644 --- a/src/main/java/fr/xephi/authme/settings/properties/ProtectionSettings.java +++ b/src/main/java/fr/xephi/authme/settings/properties/ProtectionSettings.java @@ -16,6 +16,10 @@ public class ProtectionSettings implements SettingsClass { public static final Property ENABLE_PROTECTION = newProperty("Protection.enableProtection", false); + @Comment("Apply the protection also to registered usernames") + public static final Property ENABLE_PROTECTION_REGISTERED = + newProperty("Protection.enableProtectionRegistered", true); + @Comment({"Countries allowed to join the server and register, see http://dev.bukkit.org/bukkit-plugins/authme-reloaded/pages/countries-codes/ for countries' codes", "PLEASE USE QUOTES!"}) public static final Property> COUNTRIES_WHITELIST = diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 8d4a0f0f..c0d72cf7 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -410,6 +410,8 @@ Purge: Protection: # Enable some servers protection ( country based login, antibot ) enableProtection: false + # Apply the protection also to registered usernames + enableProtectionRegistered: true # Countries allowed to join the server and register, see http://dev.bukkit.org/bukkit-plugins/authme-reloaded/pages/countries-codes/ for countries' codes # PLEASE USE QUOTES! countries: diff --git a/src/test/java/fr/xephi/authme/cache/SessionManagerTest.java b/src/test/java/fr/xephi/authme/cache/SessionManagerTest.java index 7298e2d8..7e9fffbb 100644 --- a/src/test/java/fr/xephi/authme/cache/SessionManagerTest.java +++ b/src/test/java/fr/xephi/authme/cache/SessionManagerTest.java @@ -90,7 +90,6 @@ public class SessionManagerTest { } @Test - @SuppressWarnings("unchecked") public void shouldDenySessionIfTimeoutHasExpired() { // given int timeout = 20;