mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-28 03:27:34 +01:00
Rename method on SettingsDependent
- Rename loadSettings to reload - Make ProtocolLibService only implement SettingsDependent, not Relaodable alongside
This commit is contained in:
parent
dff09935e6
commit
aa6fe3e874
@ -24,7 +24,7 @@ public class CaptchaManager implements SettingsDependent {
|
||||
CaptchaManager(NewSetting settings) {
|
||||
this.playerCounts = new ConcurrentHashMap<>();
|
||||
this.captchaCodes = new ConcurrentHashMap<>();
|
||||
loadSettings(settings);
|
||||
reload(settings);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,7 +123,7 @@ public class CaptchaManager implements SettingsDependent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadSettings(NewSetting settings) {
|
||||
public void reload(NewSetting settings) {
|
||||
this.isEnabled = settings.getProperty(SecuritySettings.USE_CAPTCHA);
|
||||
this.threshold = settings.getProperty(SecuritySettings.MAX_LOGIN_TRIES_BEFORE_CAPTCHA);
|
||||
this.captchaLength = settings.getProperty(SecuritySettings.CAPTCHA_LENGTH);
|
||||
|
@ -17,7 +17,7 @@ public class SessionManager implements SettingsDependent {
|
||||
|
||||
@Inject
|
||||
SessionManager(NewSetting settings) {
|
||||
loadSettings(settings);
|
||||
reload(settings);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,7 +67,7 @@ public class SessionManager implements SettingsDependent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadSettings(NewSetting settings) {
|
||||
public void reload(NewSetting settings) {
|
||||
this.enabled = settings.getProperty(PluginSettings.SESSIONS_ENABLED);
|
||||
this.sessionTimeout = settings.getProperty(PluginSettings.SESSIONS_TIMEOUT);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public class TempbanManager implements SettingsDependent {
|
||||
this.ipLoginFailureCounts = new ConcurrentHashMap<>();
|
||||
this.bukkitService = bukkitService;
|
||||
this.messages = messages;
|
||||
loadSettings(settings);
|
||||
reload(settings);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,7 +108,7 @@ public class TempbanManager implements SettingsDependent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadSettings(NewSetting settings) {
|
||||
public void reload(NewSetting settings) {
|
||||
this.isEnabled = settings.getProperty(SecuritySettings.TEMPBAN_ON_MAX_LOGINS);
|
||||
this.threshold = settings.getProperty(SecuritySettings.MAX_LOGIN_TEMPBAN);
|
||||
this.length = settings.getProperty(SecuritySettings.TEMPBAN_LENGTH);
|
||||
|
@ -50,7 +50,7 @@ public class HelpProvider implements SettingsDependent {
|
||||
@Inject
|
||||
HelpProvider(PermissionsManager permissionsManager, NewSetting settings) {
|
||||
this.permissionsManager = permissionsManager;
|
||||
loadSettings(settings);
|
||||
reload(settings);
|
||||
}
|
||||
|
||||
private List<String> printHelp(CommandSender sender, FoundCommandResult result, int options) {
|
||||
@ -102,7 +102,7 @@ public class HelpProvider implements SettingsDependent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadSettings(NewSetting settings) {
|
||||
public void reload(NewSetting settings) {
|
||||
helpHeader = settings.getProperty(PluginSettings.HELP_HEADER);
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ public class AuthMeServiceInitializer {
|
||||
}
|
||||
for (Object object : objects.values()) {
|
||||
if (object instanceof SettingsDependent) {
|
||||
((SettingsDependent) object).loadSettings(settings);
|
||||
((SettingsDependent) object).reload(settings);
|
||||
}
|
||||
|
||||
if (object instanceof Reloadable) {
|
||||
|
@ -8,9 +8,9 @@ import fr.xephi.authme.settings.NewSetting;
|
||||
public interface SettingsDependent {
|
||||
|
||||
/**
|
||||
* Loads the needed settings.
|
||||
* Performs a reload with the provided settings instance.
|
||||
*
|
||||
* @param settings the settings instance
|
||||
*/
|
||||
void loadSettings(NewSetting settings);
|
||||
void reload(NewSetting settings);
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class ListenerService implements SettingsDependent {
|
||||
this.dataSource = dataSource;
|
||||
this.pluginHooks = pluginHooks;
|
||||
this.playerCache = playerCache;
|
||||
loadSettings(settings);
|
||||
reload(settings);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,7 +74,7 @@ class ListenerService implements SettingsDependent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadSettings(NewSetting settings) {
|
||||
public void reload(NewSetting settings) {
|
||||
isRegistrationForced = settings.getProperty(RegistrationSettings.FORCE);
|
||||
// Keep unrestricted names as Set for more efficient contains()
|
||||
unrestrictedNames = new HashSet<>(settings.getProperty(RestrictionSettings.UNRESTRICTED_NAMES));
|
||||
|
@ -3,7 +3,6 @@ package fr.xephi.authme.listener.protocollib;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.initialization.Reloadable;
|
||||
import fr.xephi.authme.initialization.SettingsDependent;
|
||||
import fr.xephi.authme.settings.NewSetting;
|
||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
@ -12,7 +11,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class ProtocolLibService implements SettingsDependent, Reloadable {
|
||||
public class ProtocolLibService implements SettingsDependent {
|
||||
|
||||
/* Packet Adapters */
|
||||
private AuthMeInventoryPacketAdapter inventoryPacketAdapter;
|
||||
@ -33,7 +32,7 @@ public class ProtocolLibService implements SettingsDependent, Reloadable {
|
||||
this.plugin = plugin;
|
||||
this.bukkitService = bukkitService;
|
||||
this.playerCache = playerCache;
|
||||
loadSettings(settings);
|
||||
reload(settings);
|
||||
setup();
|
||||
}
|
||||
|
||||
@ -99,7 +98,7 @@ public class ProtocolLibService implements SettingsDependent, Reloadable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadSettings(NewSetting settings) {
|
||||
public void reload(NewSetting settings) {
|
||||
boolean oldProtectInventory = this.protectInvBeforeLogin;
|
||||
|
||||
this.protectInvBeforeLogin = settings.getProperty(RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN);
|
||||
@ -114,10 +113,7 @@ public class ProtocolLibService implements SettingsDependent, Reloadable {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload() {
|
||||
setup();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class Messages implements SettingsDependent {
|
||||
*/
|
||||
@Inject
|
||||
Messages(NewSetting settings) {
|
||||
loadSettings(settings);
|
||||
reload(settings);
|
||||
this.defaultFile = settings.getDefaultMessagesFile();
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ public class Messages implements SettingsDependent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadSettings(NewSetting settings) {
|
||||
public void reload(NewSetting settings) {
|
||||
File messageFile = settings.getMessagesFile();
|
||||
this.configuration = YamlConfiguration.loadConfiguration(messageFile);
|
||||
this.fileName = messageFile.getName();
|
||||
|
@ -137,7 +137,7 @@ public class CaptchaManagerTest {
|
||||
assertThat(manager.isCaptchaRequired(player), equalTo(true));
|
||||
assertHasCount(manager, player, 1);
|
||||
// end assumptions
|
||||
manager.loadSettings(settings);
|
||||
manager.reload(settings);
|
||||
boolean result = manager.isCaptchaRequired(player);
|
||||
|
||||
// then
|
||||
|
@ -114,7 +114,7 @@ public class TempbanManagerTest {
|
||||
assertThat(manager.shouldTempban(address), equalTo(true));
|
||||
assertHasCount(manager, address, 1);
|
||||
// end assumptions
|
||||
manager.loadSettings(settings);
|
||||
manager.reload(settings);
|
||||
boolean result = manager.shouldTempban(address);
|
||||
|
||||
// then
|
||||
|
@ -33,7 +33,7 @@ public class PostConstructTestClass implements SettingsDependent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadSettings(NewSetting settings) {
|
||||
public void reload(NewSetting settings) {
|
||||
if (settings != null) {
|
||||
wasReloaded = true;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ public class ListenerServiceTest {
|
||||
given(settings.getProperty(RegistrationSettings.FORCE)).willReturn(false);
|
||||
EntityEvent event = mock(EntityEvent.class);
|
||||
given(event.getEntity()).willReturn(player);
|
||||
listenerService.loadSettings(settings);
|
||||
listenerService.reload(settings);
|
||||
|
||||
// when
|
||||
boolean result = listenerService.shouldCancelEvent(event);
|
||||
|
@ -259,7 +259,7 @@ public class MessagesIntegrationTest {
|
||||
TestHelper.PROJECT_ROOT + "output/messages_test2.yml"));
|
||||
|
||||
// when
|
||||
messages.loadSettings(settings);
|
||||
messages.reload(settings);
|
||||
|
||||
// then
|
||||
assertThat(messages.retrieveSingle(key), equalTo("test2 - wrong password"));
|
||||
|
Loading…
Reference in New Issue
Block a user