mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-22 08:37:49 +01:00
Add option to apply the protection also to registered users #860
This commit is contained in:
parent
674a051586
commit
b439a0391c
@ -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);
|
||||
|
@ -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() {
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,10 @@ public class ProtectionSettings implements SettingsClass {
|
||||
public static final Property<Boolean> ENABLE_PROTECTION =
|
||||
newProperty("Protection.enableProtection", false);
|
||||
|
||||
@Comment("Apply the protection also to registered usernames")
|
||||
public static final Property<Boolean> 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<List<String>> COUNTRIES_WHITELIST =
|
||||
|
@ -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:
|
||||
|
@ -90,7 +90,6 @@ public class SessionManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void shouldDenySessionIfTimeoutHasExpired() {
|
||||
// given
|
||||
int timeout = 20;
|
||||
|
Loading…
Reference in New Issue
Block a user