mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2025-01-03 06:27:33 +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,
|
public void checkPlayerCountry(boolean isAuthAvailable,
|
||||||
PlayerLoginEvent event) throws FailedVerificationException {
|
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();
|
String playerIp = event.getAddress().getHostAddress();
|
||||||
if (!validationService.isCountryAdmitted(playerIp)) {
|
if (!validationService.isCountryAdmitted(playerIp)) {
|
||||||
throw new FailedVerificationException(MessageKey.COUNTRY_BANNED_ERROR);
|
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.process.SyncProcessManager;
|
||||||
import fr.xephi.authme.settings.SpawnLoader;
|
import fr.xephi.authme.settings.SpawnLoader;
|
||||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||||
import fr.xephi.authme.util.BukkitService;
|
|
||||||
import fr.xephi.authme.util.Utils;
|
import fr.xephi.authme.util.Utils;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -41,9 +40,6 @@ public class AsynchronousQuit implements AsynchronousProcess {
|
|||||||
@Inject
|
@Inject
|
||||||
private SpawnLoader spawnLoader;
|
private SpawnLoader spawnLoader;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private BukkitService bukkitService;
|
|
||||||
|
|
||||||
AsynchronousQuit() {
|
AsynchronousQuit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,10 @@ public class ProtectionSettings implements SettingsClass {
|
|||||||
public static final Property<Boolean> ENABLE_PROTECTION =
|
public static final Property<Boolean> ENABLE_PROTECTION =
|
||||||
newProperty("Protection.enableProtection", false);
|
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",
|
@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!"})
|
"PLEASE USE QUOTES!"})
|
||||||
public static final Property<List<String>> COUNTRIES_WHITELIST =
|
public static final Property<List<String>> COUNTRIES_WHITELIST =
|
||||||
|
@ -410,6 +410,8 @@ Purge:
|
|||||||
Protection:
|
Protection:
|
||||||
# Enable some servers protection ( country based login, antibot )
|
# Enable some servers protection ( country based login, antibot )
|
||||||
enableProtection: false
|
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
|
# 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!
|
# PLEASE USE QUOTES!
|
||||||
countries:
|
countries:
|
||||||
|
@ -90,7 +90,6 @@ public class SessionManagerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void shouldDenySessionIfTimeoutHasExpired() {
|
public void shouldDenySessionIfTimeoutHasExpired() {
|
||||||
// given
|
// given
|
||||||
int timeout = 20;
|
int timeout = 20;
|
||||||
|
Loading…
Reference in New Issue
Block a user