From 19de5a052555a684e19219a613fd9938e024ed9f Mon Sep 17 00:00:00 2001 From: ljacqu Date: Sat, 23 Jul 2016 15:50:40 +0200 Subject: [PATCH] Close #449 Rename NewSetting class to Settings :) --- src/main/java/fr/xephi/authme/AntiBot.java | 6 +-- src/main/java/fr/xephi/authme/AuthMe.java | 54 +++++++++---------- .../java/fr/xephi/authme/ConsoleLogger.java | 4 +- .../java/fr/xephi/authme/PerformBackup.java | 6 +-- .../fr/xephi/authme/cache/CaptchaManager.java | 6 +-- .../fr/xephi/authme/cache/SessionManager.java | 6 +-- .../fr/xephi/authme/cache/TempbanManager.java | 6 +-- .../xephi/authme/cache/limbo/LimboCache.java | 6 +-- .../xephi/authme/command/CommandService.java | 6 +-- .../executable/authme/ReloadCommand.java | 4 +- .../authme/command/help/HelpProvider.java | 6 +-- .../authme/converter/CrazyLoginConverter.java | 6 +-- .../authme/converter/RakamakConverter.java | 6 +-- .../xephi/authme/converter/SqliteToSql.java | 6 +-- .../fr/xephi/authme/datasource/Columns.java | 4 +- .../fr/xephi/authme/datasource/MySQL.java | 8 +-- .../fr/xephi/authme/datasource/SQLite.java | 6 +-- .../xephi/authme/hooks/BungeeCordMessage.java | 4 +- .../authme/initialization/MetricsStarter.java | 4 +- .../initialization/SettingsDependent.java | 4 +- .../authme/listener/AuthMePlayerListener.java | 4 +- .../authme/listener/ListenerService.java | 6 +-- .../xephi/authme/listener/OnJoinVerifier.java | 4 +- .../protocollib/ProtocolLibService.java | 6 +-- .../fr/xephi/authme/mail/SendMailSSL.java | 4 +- .../java/fr/xephi/authme/output/Messages.java | 6 +-- .../authme/permission/AuthGroupHandler.java | 4 +- .../xephi/authme/process/ProcessService.java | 6 +-- .../authme/security/PasswordSecurity.java | 4 +- .../xephi/authme/security/crypts/BCRYPT.java | 4 +- .../authme/security/crypts/SALTED2MD5.java | 4 +- .../xephi/authme/service/BungeeService.java | 6 +-- .../{NewSetting.java => Settings.java} | 12 ++--- .../fr/xephi/authme/settings/SpawnLoader.java | 4 +- .../authme/task/PlayerDataTaskManager.java | 4 +- .../authme/task/purge/PurgeExecutor.java | 4 +- .../xephi/authme/task/purge/PurgeService.java | 4 +- .../xephi/authme/util/MigrationService.java | 6 +-- .../authme/util/TeleportationService.java | 4 +- .../xephi/authme/util/ValidationService.java | 4 +- .../java/fr/xephi/authme/AntiBotTest.java | 4 +- .../authme/AuthMeInitializationTest.java | 6 +-- .../fr/xephi/authme/ConsoleLoggerTest.java | 8 +-- .../authme/cache/CaptchaManagerTest.java | 18 +++---- .../authme/cache/SessionManagerTest.java | 20 +++---- .../authme/cache/TempbanManagerTest.java | 20 +++---- .../authme/cache/limbo/LimboCacheTest.java | 4 +- .../authme/command/CommandServiceTest.java | 6 +-- .../executable/authme/ReloadCommandTest.java | 4 +- .../authme/command/help/HelpProviderTest.java | 4 +- .../converter/CrazyLoginConverterTest.java | 4 +- .../AbstractResourceClosingTest.java | 8 +-- .../datasource/MySqlIntegrationTest.java | 6 +-- .../datasource/MySqlResourceClosingTest.java | 4 +- .../datasource/SQLiteIntegrationTest.java | 6 +-- .../datasource/SQLiteResourceClosingTest.java | 4 +- .../authme/listener/ListenerServiceTest.java | 4 +- .../authme/listener/OnJoinVerifierTest.java | 4 +- .../output/MessagesIntegrationTest.java | 8 +-- .../authme/process/ProcessServiceTest.java | 6 +-- .../HashAlgorithmIntegrationTest.java | 6 +-- .../authme/security/PasswordSecurityTest.java | 6 +-- .../authme/security/crypts/BcryptTest.java | 6 +-- .../security/crypts/SALTED2MD5Test.java | 6 +-- .../settings/ConfigFileConsistencyTest.java | 2 +- ...Test.java => SettingsIntegrationTest.java} | 16 +++--- ...{NewSettingTest.java => SettingsTest.java} | 20 +++---- .../authme/settings/SpawnLoaderTest.java | 2 +- .../task/PlayerDataTaskManagerTest.java | 4 +- .../authme/task/purge/PurgeServiceTest.java | 4 +- .../authme/util/MigrationServiceTest.java | 4 +- .../authme/util/TeleportationServiceTest.java | 4 +- .../authme/util/ValidationServiceTest.java | 4 +- .../EncryptionMethodInfoGatherer.java | 6 +-- 74 files changed, 248 insertions(+), 248 deletions(-) rename src/main/java/fr/xephi/authme/settings/{NewSetting.java => Settings.java} (96%) rename src/test/java/fr/xephi/authme/settings/{NewSettingIntegrationTest.java => SettingsIntegrationTest.java} (92%) rename src/test/java/fr/xephi/authme/settings/{NewSettingTest.java => SettingsTest.java} (92%) diff --git a/src/main/java/fr/xephi/authme/AntiBot.java b/src/main/java/fr/xephi/authme/AntiBot.java index 37f048724..81fd11b07 100644 --- a/src/main/java/fr/xephi/authme/AntiBot.java +++ b/src/main/java/fr/xephi/authme/AntiBot.java @@ -4,7 +4,7 @@ import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.Messages; import fr.xephi.authme.permission.PermissionsManager; import fr.xephi.authme.permission.PlayerStatePermission; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.ProtectionSettings; import fr.xephi.authme.util.BukkitService; import org.bukkit.entity.Player; @@ -20,7 +20,7 @@ import static fr.xephi.authme.util.BukkitService.TICKS_PER_SECOND; */ public class AntiBot { - private final NewSetting settings; + private final Settings settings; private final Messages messages; private final PermissionsManager permissionsManager; private final BukkitService bukkitService; @@ -29,7 +29,7 @@ public class AntiBot { private AntiBotStatus antiBotStatus = AntiBotStatus.DISABLED; @Inject - AntiBot(NewSetting settings, Messages messages, PermissionsManager permissionsManager, + AntiBot(Settings settings, Messages messages, PermissionsManager permissionsManager, BukkitService bukkitService) { this.settings = settings; this.messages = messages; diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index b40d807bf..88972acea 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -34,7 +34,7 @@ import fr.xephi.authme.permission.PermissionsManager; import fr.xephi.authme.permission.PermissionsSystemType; import fr.xephi.authme.process.Management; import fr.xephi.authme.security.crypts.SHA256; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.SettingsMigrationService; import fr.xephi.authme.settings.SpawnLoader; import fr.xephi.authme.settings.properties.DatabaseSettings; @@ -103,7 +103,7 @@ public class AuthMe extends JavaPlugin { private Management management; private CommandHandler commandHandler; private PermissionsManager permsMan; - private NewSetting newSettings; + private Settings settings; private Messages messages; private DataSource database; private PluginHooks pluginHooks; @@ -193,8 +193,8 @@ public class AuthMe extends JavaPlugin { ConsoleLogger.setLogFile(new File(getDataFolder(), "authme.log")); // Load settings and custom configurations, if it fails, stop the server due to security reasons. - newSettings = createNewSetting(); - if (newSettings == null) { + settings = createSettings(); + if (settings == null) { getLogger().warning("Could not load configuration. Aborting."); getServer().shutdown(); setEnabled(false); @@ -202,11 +202,11 @@ public class AuthMe extends JavaPlugin { } // Apply settings to the logger - ConsoleLogger.setLoggingOptions(newSettings); + ConsoleLogger.setLoggingOptions(settings); // Connect to the database and setup tables try { - setupDatabase(newSettings); + setupDatabase(settings); } catch (Exception e) { ConsoleLogger.logException("Fatal error occurred during database connection! " + "Authme initialization aborted!", e); @@ -214,7 +214,7 @@ public class AuthMe extends JavaPlugin { return; } // Convert deprecated PLAINTEXT hash entries - MigrationService.changePlainTextToSha256(newSettings, database, new SHA256()); + MigrationService.changePlainTextToSha256(settings, database, new SHA256()); // Injector initialization injector = new InjectorBuilder().addDefaultHandlers("fr.xephi.authme").create(); @@ -227,20 +227,20 @@ public class AuthMe extends JavaPlugin { injector.provide(DataFolder.class, getDataFolder()); // Register elements we instantiate manually - injector.register(NewSetting.class, newSettings); + injector.register(Settings.class, settings); injector.register(DataSource.class, database); instantiateServices(injector); // Set up Metrics - MetricsStarter.setupMetrics(this, newSettings); + MetricsStarter.setupMetrics(this, settings); // Set console filter setupConsoleFilter(); // Do a backup on start // TODO: maybe create a backup manager? - new PerformBackup(this, newSettings).doBackup(PerformBackup.BackupCause.START); + new PerformBackup(this, settings).doBackup(PerformBackup.BackupCause.START); // Set up the BungeeCord hook setupBungeeCordHook(); @@ -297,13 +297,13 @@ public class AuthMe extends JavaPlugin { */ private void showSettingsWarnings() { // Force single session disabled - if (!newSettings.getProperty(RestrictionSettings.FORCE_SINGLE_SESSION)) { + if (!settings.getProperty(RestrictionSettings.FORCE_SINGLE_SESSION)) { ConsoleLogger.warning("WARNING!!! By disabling ForceSingleSession, your server protection is inadequate!"); } // Session timeout disabled - if (newSettings.getProperty(PluginSettings.SESSIONS_TIMEOUT) == 0 - && newSettings.getProperty(PluginSettings.SESSIONS_ENABLED)) { + if (settings.getProperty(PluginSettings.SESSIONS_TIMEOUT) == 0 + && settings.getProperty(PluginSettings.SESSIONS_ENABLED)) { ConsoleLogger.warning("WARNING!!! You set session timeout to 0, this may cause security issues!"); } } @@ -341,7 +341,7 @@ public class AuthMe extends JavaPlugin { int playersOnline = bukkitService.getOnlinePlayers().size(); if (playersOnline < 1) { database.purgeLogged(); - } else if (newSettings.getProperty(SecuritySettings.USE_RELOAD_COMMAND_SUPPORT)) { + } else if (settings.getProperty(SecuritySettings.USE_RELOAD_COMMAND_SUPPORT)) { for (PlayerAuth auth : database.getLoggedPlayers()) { if (auth != null) { auth.setLastLogin(new Date().getTime()); @@ -357,7 +357,7 @@ public class AuthMe extends JavaPlugin { * Set up the BungeeCord hook. */ private void setupBungeeCordHook() { - if (newSettings.getProperty(HooksSettings.BUNGEECORD)) { + if (settings.getProperty(HooksSettings.BUNGEECORD)) { Messenger messenger = Bukkit.getMessenger(); messenger.registerOutgoingPluginChannel(this, "BungeeCord"); messenger.registerIncomingPluginChannel(this, "BungeeCord", injector.getSingleton(BungeeCordMessage.class)); @@ -369,12 +369,12 @@ public class AuthMe extends JavaPlugin { * * @return The settings instance, or null if it could not be constructed */ - private NewSetting createNewSetting() { + private Settings createSettings() { File configFile = new File(getDataFolder(), "config.yml"); PropertyMap properties = SettingsFieldRetriever.getAllPropertyFields(); SettingsMigrationService migrationService = new SettingsMigrationService(); return FileUtils.copyFileFromResource(configFile, "config.yml") - ? new NewSetting(configFile, getDataFolder(), properties, migrationService) + ? new Settings(configFile, getDataFolder(), properties, migrationService) : null; } @@ -382,7 +382,7 @@ public class AuthMe extends JavaPlugin { * Set up the console filter. */ private void setupConsoleFilter() { - if (!newSettings.getProperty(SecuritySettings.REMOVE_PASSWORD_FROM_CONSOLE)) { + if (!settings.getProperty(SecuritySettings.REMOVE_PASSWORD_FROM_CONSOLE)) { return; } // Try to set the log4j filter @@ -414,8 +414,8 @@ public class AuthMe extends JavaPlugin { } // Do backup on stop if enabled - if (newSettings != null) { - new PerformBackup(this, newSettings).doBackup(PerformBackup.BackupCause.STOP); + if (settings != null) { + new PerformBackup(this, settings).doBackup(PerformBackup.BackupCause.STOP); } new Thread(new Runnable() { @@ -474,7 +474,7 @@ public class AuthMe extends JavaPlugin { // Stop/unload the server/plugin as defined in the configuration public void stopOrUnload() { - if (newSettings == null || newSettings.getProperty(SecuritySettings.STOP_SERVER_ON_PROBLEM)) { + if (settings == null || settings.getProperty(SecuritySettings.STOP_SERVER_ON_PROBLEM)) { ConsoleLogger.warning("THE SERVER IS GOING TO SHUT DOWN AS DEFINED IN THE CONFIGURATION!"); getServer().shutdown(); } else { @@ -492,7 +492,7 @@ public class AuthMe extends JavaPlugin { * @throws IOException if flat file cannot be read * @see AuthMe#database */ - public void setupDatabase(NewSetting settings) throws ClassNotFoundException, SQLException, IOException { + public void setupDatabase(Settings settings) throws ClassNotFoundException, SQLException, IOException { if (this.database != null) { this.database.close(); } @@ -552,7 +552,7 @@ public class AuthMe extends JavaPlugin { limboCache.restoreData(player); limboCache.removeFromCache(player); } else { - if (newSettings.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) { + if (settings.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) { Location loc = spawnLoader.getPlayerLocationOrSpawn(player); final PlayerAuth auth = PlayerAuth.builder() .name(player.getName().toLowerCase()) @@ -560,8 +560,8 @@ public class AuthMe extends JavaPlugin { .location(loc).build(); database.updateQuitLoc(auth); } - if (newSettings.getProperty(RestrictionSettings.TELEPORT_UNAUTHED_TO_SPAWN) - && !newSettings.getProperty(RestrictionSettings.NO_TELEPORT)) { + if (settings.getProperty(RestrictionSettings.TELEPORT_UNAUTHED_TO_SPAWN) + && !settings.getProperty(RestrictionSettings.NO_TELEPORT)) { PlayerDataStorage playerDataStorage = injector.getIfAvailable(PlayerDataStorage.class); if (playerDataStorage != null && !playerDataStorage.hasData(player)) { playerDataStorage.saveData(player); @@ -576,7 +576,7 @@ public class AuthMe extends JavaPlugin { } private void scheduleRecallEmailTask() { - if (!newSettings.getProperty(RECALL_PLAYERS)) { + if (!settings.getProperty(RECALL_PLAYERS)) { return; } Bukkit.getScheduler().runTaskTimerAsynchronously(this, new Runnable() { @@ -592,7 +592,7 @@ public class AuthMe extends JavaPlugin { } } } - }, 1, 1200 * newSettings.getProperty(EmailSettings.DELAY_RECALL)); + }, 1, 1200 * settings.getProperty(EmailSettings.DELAY_RECALL)); } public String replaceAllInfo(String message, Player player) { diff --git a/src/main/java/fr/xephi/authme/ConsoleLogger.java b/src/main/java/fr/xephi/authme/ConsoleLogger.java index fba494d00..b01674591 100644 --- a/src/main/java/fr/xephi/authme/ConsoleLogger.java +++ b/src/main/java/fr/xephi/authme/ConsoleLogger.java @@ -2,7 +2,7 @@ package fr.xephi.authme; import com.google.common.base.Throwables; import fr.xephi.authme.output.LogLevel; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.PluginSettings; import fr.xephi.authme.settings.properties.SecuritySettings; import fr.xephi.authme.util.StringUtils; @@ -58,7 +58,7 @@ public final class ConsoleLogger { * * @param settings The settings instance */ - public static void setLoggingOptions(NewSetting settings) { + public static void setLoggingOptions(Settings settings) { ConsoleLogger.logLevel = settings.getProperty(PluginSettings.LOG_LEVEL); ConsoleLogger.useLogging = settings.getProperty(SecuritySettings.USE_LOGGING); if (useLogging) { diff --git a/src/main/java/fr/xephi/authme/PerformBackup.java b/src/main/java/fr/xephi/authme/PerformBackup.java index f41e78301..79f1bf9f5 100644 --- a/src/main/java/fr/xephi/authme/PerformBackup.java +++ b/src/main/java/fr/xephi/authme/PerformBackup.java @@ -1,7 +1,7 @@ package fr.xephi.authme; import fr.xephi.authme.datasource.DataSourceType; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.BackupSettings; import fr.xephi.authme.settings.properties.DatabaseSettings; import fr.xephi.authme.util.StringUtils; @@ -30,7 +30,7 @@ public class PerformBackup { private final String tblname; private final String path; private final File dataFolder; - private final NewSetting settings; + private final Settings settings; /** * Constructor for PerformBackup. @@ -38,7 +38,7 @@ public class PerformBackup { * @param instance AuthMe * @param settings The plugin settings */ - public PerformBackup(AuthMe instance, NewSetting settings) { + public PerformBackup(AuthMe instance, Settings settings) { this.dataFolder = instance.getDataFolder(); this.settings = settings; this.dbName = settings.getProperty(DatabaseSettings.MYSQL_DATABASE); diff --git a/src/main/java/fr/xephi/authme/cache/CaptchaManager.java b/src/main/java/fr/xephi/authme/cache/CaptchaManager.java index a029be26e..f37637df0 100644 --- a/src/main/java/fr/xephi/authme/cache/CaptchaManager.java +++ b/src/main/java/fr/xephi/authme/cache/CaptchaManager.java @@ -2,7 +2,7 @@ package fr.xephi.authme.cache; import fr.xephi.authme.initialization.SettingsDependent; import fr.xephi.authme.security.RandomString; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.SecuritySettings; import javax.inject.Inject; @@ -21,7 +21,7 @@ public class CaptchaManager implements SettingsDependent { private int captchaLength; @Inject - CaptchaManager(NewSetting settings) { + CaptchaManager(Settings settings) { this.playerCounts = new ConcurrentHashMap<>(); this.captchaCodes = new ConcurrentHashMap<>(); reload(settings); @@ -123,7 +123,7 @@ public class CaptchaManager implements SettingsDependent { } @Override - public void reload(NewSetting settings) { + public void reload(Settings 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); diff --git a/src/main/java/fr/xephi/authme/cache/SessionManager.java b/src/main/java/fr/xephi/authme/cache/SessionManager.java index d14dc9aa2..fab1e1cfd 100644 --- a/src/main/java/fr/xephi/authme/cache/SessionManager.java +++ b/src/main/java/fr/xephi/authme/cache/SessionManager.java @@ -1,7 +1,7 @@ package fr.xephi.authme.cache; import fr.xephi.authme.initialization.SettingsDependent; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.PluginSettings; import javax.inject.Inject; @@ -22,7 +22,7 @@ public class SessionManager implements SettingsDependent { private int timeoutInMinutes; @Inject - SessionManager(NewSetting settings) { + SessionManager(Settings settings) { reload(settings); } @@ -64,7 +64,7 @@ public class SessionManager implements SettingsDependent { } @Override - public void reload(NewSetting settings) { + public void reload(Settings settings) { timeoutInMinutes = settings.getProperty(PluginSettings.SESSIONS_TIMEOUT); boolean oldEnabled = enabled; enabled = timeoutInMinutes > 0 && settings.getProperty(PluginSettings.SESSIONS_ENABLED); diff --git a/src/main/java/fr/xephi/authme/cache/TempbanManager.java b/src/main/java/fr/xephi/authme/cache/TempbanManager.java index 07dd26138..c5f0ee6f1 100644 --- a/src/main/java/fr/xephi/authme/cache/TempbanManager.java +++ b/src/main/java/fr/xephi/authme/cache/TempbanManager.java @@ -3,7 +3,7 @@ package fr.xephi.authme.cache; import fr.xephi.authme.initialization.SettingsDependent; import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.Messages; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.SecuritySettings; import fr.xephi.authme.util.BukkitService; import fr.xephi.authme.util.Utils; @@ -30,7 +30,7 @@ public class TempbanManager implements SettingsDependent { private int length; @Inject - TempbanManager(BukkitService bukkitService, Messages messages, NewSetting settings) { + TempbanManager(BukkitService bukkitService, Messages messages, Settings settings) { this.ipLoginFailureCounts = new ConcurrentHashMap<>(); this.bukkitService = bukkitService; this.messages = messages; @@ -108,7 +108,7 @@ public class TempbanManager implements SettingsDependent { } @Override - public void reload(NewSetting settings) { + public void reload(Settings 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); diff --git a/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java b/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java index f5f144738..4f973294e 100644 --- a/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java +++ b/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java @@ -2,7 +2,7 @@ package fr.xephi.authme.cache.limbo; import fr.xephi.authme.cache.backup.PlayerDataStorage; import fr.xephi.authme.permission.PermissionsManager; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.SpawnLoader; import fr.xephi.authme.settings.properties.PluginSettings; import fr.xephi.authme.util.StringUtils; @@ -23,12 +23,12 @@ public class LimboCache { private final Map cache = new ConcurrentHashMap<>(); private PlayerDataStorage playerDataStorage; - private NewSetting settings; + private Settings settings; private PermissionsManager permissionsManager; private SpawnLoader spawnLoader; @Inject - LimboCache(NewSetting settings, PermissionsManager permissionsManager, + LimboCache(Settings settings, PermissionsManager permissionsManager, SpawnLoader spawnLoader, PlayerDataStorage playerDataStorage) { this.settings = settings; this.permissionsManager = permissionsManager; diff --git a/src/main/java/fr/xephi/authme/command/CommandService.java b/src/main/java/fr/xephi/authme/command/CommandService.java index 5114d1ffc..567bcb306 100644 --- a/src/main/java/fr/xephi/authme/command/CommandService.java +++ b/src/main/java/fr/xephi/authme/command/CommandService.java @@ -2,7 +2,7 @@ package fr.xephi.authme.command; import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.Messages; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.domain.Property; import fr.xephi.authme.util.ValidationService; import org.bukkit.command.CommandSender; @@ -18,7 +18,7 @@ public class CommandService { @Inject private Messages messages; @Inject - private NewSetting settings; + private Settings settings; @Inject private ValidationService validationService; @@ -79,7 +79,7 @@ public class CommandService { * * @return The settings manager */ - public NewSetting getSettings() { + public Settings getSettings() { return settings; } diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java index 1a7d1a691..e6b8009fc 100644 --- a/src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java @@ -9,7 +9,7 @@ import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.initialization.Reloadable; import fr.xephi.authme.initialization.SettingsDependent; import fr.xephi.authme.output.MessageKey; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.DatabaseSettings; import org.bukkit.command.CommandSender; @@ -29,7 +29,7 @@ public class ReloadCommand implements ExecutableCommand { private Injector injector; @Inject - private NewSetting settings; + private Settings settings; @Inject private DataSource dataSource; diff --git a/src/main/java/fr/xephi/authme/command/help/HelpProvider.java b/src/main/java/fr/xephi/authme/command/help/HelpProvider.java index 727842a6b..ebe8c0cb0 100644 --- a/src/main/java/fr/xephi/authme/command/help/HelpProvider.java +++ b/src/main/java/fr/xephi/authme/command/help/HelpProvider.java @@ -10,7 +10,7 @@ import fr.xephi.authme.initialization.SettingsDependent; import fr.xephi.authme.permission.DefaultPermission; import fr.xephi.authme.permission.PermissionNode; import fr.xephi.authme.permission.PermissionsManager; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.PluginSettings; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; @@ -48,7 +48,7 @@ public class HelpProvider implements SettingsDependent { private String helpHeader; @Inject - HelpProvider(PermissionsManager permissionsManager, NewSetting settings) { + HelpProvider(PermissionsManager permissionsManager, Settings settings) { this.permissionsManager = permissionsManager; reload(settings); } @@ -102,7 +102,7 @@ public class HelpProvider implements SettingsDependent { } @Override - public void reload(NewSetting settings) { + public void reload(Settings settings) { helpHeader = settings.getProperty(PluginSettings.HELP_HEADER); } diff --git a/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java b/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java index ce2e834ac..50cb43c1d 100644 --- a/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java +++ b/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java @@ -4,7 +4,7 @@ import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.initialization.DataFolder; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.ConverterSettings; import org.bukkit.command.CommandSender; @@ -20,11 +20,11 @@ import java.io.IOException; public class CrazyLoginConverter implements Converter { private final DataSource database; - private final NewSetting settings; + private final Settings settings; private final File dataFolder; @Inject - CrazyLoginConverter(@DataFolder File dataFolder, DataSource dataSource, NewSetting settings) { + CrazyLoginConverter(@DataFolder File dataFolder, DataSource dataSource, Settings settings) { this.dataFolder = dataFolder; this.database = dataSource; this.settings = settings; diff --git a/src/main/java/fr/xephi/authme/converter/RakamakConverter.java b/src/main/java/fr/xephi/authme/converter/RakamakConverter.java index f6350119c..f8892e393 100644 --- a/src/main/java/fr/xephi/authme/converter/RakamakConverter.java +++ b/src/main/java/fr/xephi/authme/converter/RakamakConverter.java @@ -6,7 +6,7 @@ import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.initialization.DataFolder; import fr.xephi.authme.security.PasswordSecurity; import fr.xephi.authme.security.crypts.HashedPassword; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.ConverterSettings; import org.bukkit.command.CommandSender; @@ -24,12 +24,12 @@ import java.util.Map.Entry; public class RakamakConverter implements Converter { private final DataSource database; - private final NewSetting settings; + private final Settings settings; private final File pluginFolder; private final PasswordSecurity passwordSecurity; @Inject - RakamakConverter(@DataFolder File dataFolder, DataSource dataSource, NewSetting settings, + RakamakConverter(@DataFolder File dataFolder, DataSource dataSource, Settings settings, PasswordSecurity passwordSecurity) { this.database = dataSource; this.settings = settings; diff --git a/src/main/java/fr/xephi/authme/converter/SqliteToSql.java b/src/main/java/fr/xephi/authme/converter/SqliteToSql.java index 611684802..dbb127f5e 100644 --- a/src/main/java/fr/xephi/authme/converter/SqliteToSql.java +++ b/src/main/java/fr/xephi/authme/converter/SqliteToSql.java @@ -7,19 +7,19 @@ import fr.xephi.authme.datasource.DataSourceType; import fr.xephi.authme.datasource.SQLite; import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.Messages; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import org.bukkit.command.CommandSender; import javax.inject.Inject; public class SqliteToSql implements Converter { - private final NewSetting settings; + private final Settings settings; private final DataSource dataSource; private final Messages messages; @Inject - SqliteToSql(NewSetting settings, DataSource dataSource, Messages messages) { + SqliteToSql(Settings settings, DataSource dataSource, Messages messages) { this.settings = settings; this.dataSource = dataSource; this.messages = messages; diff --git a/src/main/java/fr/xephi/authme/datasource/Columns.java b/src/main/java/fr/xephi/authme/datasource/Columns.java index adef938b0..b6d732cdb 100644 --- a/src/main/java/fr/xephi/authme/datasource/Columns.java +++ b/src/main/java/fr/xephi/authme/datasource/Columns.java @@ -1,6 +1,6 @@ package fr.xephi.authme.datasource; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.DatabaseSettings; /** @@ -23,7 +23,7 @@ public final class Columns { public final String ID; public final String IS_LOGGED; - public Columns(NewSetting settings) { + public Columns(Settings settings) { NAME = settings.getProperty(DatabaseSettings.MYSQL_COL_NAME); REAL_NAME = settings.getProperty(DatabaseSettings.MYSQL_COL_REALNAME); PASSWORD = settings.getProperty(DatabaseSettings.MYSQL_COL_PASSWORD); diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 9a31c73cf..b106c0d8f 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -8,7 +8,7 @@ import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.security.crypts.HashedPassword; import fr.xephi.authme.security.crypts.XFBCRYPT; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.DatabaseSettings; import fr.xephi.authme.settings.properties.HooksSettings; import fr.xephi.authme.settings.properties.SecuritySettings; @@ -45,7 +45,7 @@ public class MySQL implements DataSource { private int phpBbGroup; private String wordpressPrefix; - public MySQL(NewSetting settings) throws ClassNotFoundException, SQLException, PoolInitializationException { + public MySQL(Settings settings) throws ClassNotFoundException, SQLException, PoolInitializationException { setParameters(settings); // Set the connection arguments (and check if connection is ok) @@ -76,12 +76,12 @@ public class MySQL implements DataSource { } @VisibleForTesting - MySQL(NewSetting settings, HikariDataSource hikariDataSource) { + MySQL(Settings settings, HikariDataSource hikariDataSource) { ds = hikariDataSource; setParameters(settings); } - private void setParameters(NewSetting settings) { + private void setParameters(Settings settings) { this.host = settings.getProperty(DatabaseSettings.MYSQL_HOST); this.port = settings.getProperty(DatabaseSettings.MYSQL_PORT); this.username = settings.getProperty(DatabaseSettings.MYSQL_USERNAME); diff --git a/src/main/java/fr/xephi/authme/datasource/SQLite.java b/src/main/java/fr/xephi/authme/datasource/SQLite.java index 083195fa6..8aae94c58 100644 --- a/src/main/java/fr/xephi/authme/datasource/SQLite.java +++ b/src/main/java/fr/xephi/authme/datasource/SQLite.java @@ -4,7 +4,7 @@ import com.google.common.annotations.VisibleForTesting; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.security.crypts.HashedPassword; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.DatabaseSettings; import fr.xephi.authme.util.StringUtils; @@ -38,7 +38,7 @@ public class SQLite implements DataSource { * @throws ClassNotFoundException if no driver could be found for the datasource * @throws SQLException when initialization of a SQL datasource failed */ - public SQLite(NewSetting settings) throws ClassNotFoundException, SQLException { + public SQLite(Settings settings) throws ClassNotFoundException, SQLException { this.database = settings.getProperty(DatabaseSettings.MYSQL_DATABASE); this.tableName = settings.getProperty(DatabaseSettings.MYSQL_TABLE); this.col = new Columns(settings); @@ -53,7 +53,7 @@ public class SQLite implements DataSource { } @VisibleForTesting - SQLite(NewSetting settings, Connection connection) { + SQLite(Settings settings, Connection connection) { this.database = settings.getProperty(DatabaseSettings.MYSQL_DATABASE); this.tableName = settings.getProperty(DatabaseSettings.MYSQL_TABLE); this.col = new Columns(settings); diff --git a/src/main/java/fr/xephi/authme/hooks/BungeeCordMessage.java b/src/main/java/fr/xephi/authme/hooks/BungeeCordMessage.java index 6eccc98ee..62e7396d1 100644 --- a/src/main/java/fr/xephi/authme/hooks/BungeeCordMessage.java +++ b/src/main/java/fr/xephi/authme/hooks/BungeeCordMessage.java @@ -7,7 +7,7 @@ import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.security.crypts.HashedPassword; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.util.BukkitService; import org.bukkit.entity.Player; import org.bukkit.plugin.messaging.PluginMessageListener; @@ -27,7 +27,7 @@ public class BungeeCordMessage implements PluginMessageListener { private PlayerCache playerCache; @Inject - private NewSetting settings; + private Settings settings; BungeeCordMessage() { } diff --git a/src/main/java/fr/xephi/authme/initialization/MetricsStarter.java b/src/main/java/fr/xephi/authme/initialization/MetricsStarter.java index 4a163f98a..19836f608 100644 --- a/src/main/java/fr/xephi/authme/initialization/MetricsStarter.java +++ b/src/main/java/fr/xephi/authme/initialization/MetricsStarter.java @@ -2,7 +2,7 @@ package fr.xephi.authme.initialization; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.DatabaseSettings; import fr.xephi.authme.settings.properties.PluginSettings; import org.mcstats.Metrics; @@ -15,7 +15,7 @@ public class MetricsStarter { private MetricsStarter() { } - public static void setupMetrics(AuthMe plugin, NewSetting settings) { + public static void setupMetrics(AuthMe plugin, Settings settings) { try { final Metrics metrics = new Metrics(plugin); diff --git a/src/main/java/fr/xephi/authme/initialization/SettingsDependent.java b/src/main/java/fr/xephi/authme/initialization/SettingsDependent.java index 858bc5e87..487f70d58 100644 --- a/src/main/java/fr/xephi/authme/initialization/SettingsDependent.java +++ b/src/main/java/fr/xephi/authme/initialization/SettingsDependent.java @@ -1,6 +1,6 @@ package fr.xephi.authme.initialization; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; /** * Interface for classes that keep a local copy of certain settings. @@ -12,5 +12,5 @@ public interface SettingsDependent { * * @param settings the settings instance */ - void reload(NewSetting settings); + void reload(Settings settings); } diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 11323ada9..d79132b16 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -6,7 +6,7 @@ import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.Messages; import fr.xephi.authme.process.Management; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.SpawnLoader; import fr.xephi.authme.settings.properties.HooksSettings; import fr.xephi.authme.settings.properties.RegistrationSettings; @@ -56,7 +56,7 @@ public class AuthMePlayerListener implements Listener { public static final ConcurrentHashMap joinMessage = new ConcurrentHashMap<>(); @Inject - private NewSetting settings; + private Settings settings; @Inject private Messages m; @Inject diff --git a/src/main/java/fr/xephi/authme/listener/ListenerService.java b/src/main/java/fr/xephi/authme/listener/ListenerService.java index fbaac456b..8427431c1 100644 --- a/src/main/java/fr/xephi/authme/listener/ListenerService.java +++ b/src/main/java/fr/xephi/authme/listener/ListenerService.java @@ -4,7 +4,7 @@ import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.hooks.PluginHooks; import fr.xephi.authme.initialization.SettingsDependent; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.RegistrationSettings; import fr.xephi.authme.util.ValidationService; import org.bukkit.entity.Entity; @@ -27,7 +27,7 @@ class ListenerService implements SettingsDependent { private boolean isRegistrationForced; @Inject - ListenerService(NewSetting settings, DataSource dataSource, PluginHooks pluginHooks, + ListenerService(Settings settings, DataSource dataSource, PluginHooks pluginHooks, PlayerCache playerCache, ValidationService validationService) { this.dataSource = dataSource; this.pluginHooks = pluginHooks; @@ -74,7 +74,7 @@ class ListenerService implements SettingsDependent { } @Override - public void reload(NewSetting settings) { + public void reload(Settings settings) { isRegistrationForced = settings.getProperty(RegistrationSettings.FORCE); } diff --git a/src/main/java/fr/xephi/authme/listener/OnJoinVerifier.java b/src/main/java/fr/xephi/authme/listener/OnJoinVerifier.java index 6fbee2910..50ee67b2f 100644 --- a/src/main/java/fr/xephi/authme/listener/OnJoinVerifier.java +++ b/src/main/java/fr/xephi/authme/listener/OnJoinVerifier.java @@ -9,7 +9,7 @@ import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.Messages; import fr.xephi.authme.permission.PermissionsManager; import fr.xephi.authme.permission.PlayerStatePermission; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.ProtectionSettings; import fr.xephi.authme.settings.properties.RegistrationSettings; import fr.xephi.authme.settings.properties.RestrictionSettings; @@ -32,7 +32,7 @@ import java.util.regex.Pattern; class OnJoinVerifier implements Reloadable { @Inject - private NewSetting settings; + private Settings settings; @Inject private DataSource dataSource; @Inject diff --git a/src/main/java/fr/xephi/authme/listener/protocollib/ProtocolLibService.java b/src/main/java/fr/xephi/authme/listener/protocollib/ProtocolLibService.java index 9298679b6..348f61b5a 100644 --- a/src/main/java/fr/xephi/authme/listener/protocollib/ProtocolLibService.java +++ b/src/main/java/fr/xephi/authme/listener/protocollib/ProtocolLibService.java @@ -5,7 +5,7 @@ import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.initialization.SettingsDependent; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.RestrictionSettings; import fr.xephi.authme.util.BukkitService; import org.bukkit.entity.Player; @@ -30,7 +30,7 @@ public class ProtocolLibService implements SettingsDependent { private PlayerCache playerCache; @Inject - ProtocolLibService(AuthMe plugin, NewSetting settings, BukkitService bukkitService, PlayerCache playerCache) { + ProtocolLibService(AuthMe plugin, Settings settings, BukkitService bukkitService, PlayerCache playerCache) { this.plugin = plugin; this.bukkitService = bukkitService; this.playerCache = playerCache; @@ -99,7 +99,7 @@ public class ProtocolLibService implements SettingsDependent { } @Override - public void reload(NewSetting settings) { + public void reload(Settings settings) { boolean oldProtectInventory = this.protectInvBeforeLogin; this.protectInvBeforeLogin = settings.getProperty(RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN); diff --git a/src/main/java/fr/xephi/authme/mail/SendMailSSL.java b/src/main/java/fr/xephi/authme/mail/SendMailSSL.java index 6cd35c28e..6088a5bca 100644 --- a/src/main/java/fr/xephi/authme/mail/SendMailSSL.java +++ b/src/main/java/fr/xephi/authme/mail/SendMailSSL.java @@ -3,7 +3,7 @@ package fr.xephi.authme.mail; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.auth.PlayerAuth; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.EmailSettings; import fr.xephi.authme.util.BukkitService; import fr.xephi.authme.util.StringUtils; @@ -33,7 +33,7 @@ public class SendMailSSL { @Inject private AuthMe plugin; @Inject - private NewSetting settings; + private Settings settings; @Inject private BukkitService bukkitService; diff --git a/src/main/java/fr/xephi/authme/output/Messages.java b/src/main/java/fr/xephi/authme/output/Messages.java index 1f2a7e660..16abcb399 100644 --- a/src/main/java/fr/xephi/authme/output/Messages.java +++ b/src/main/java/fr/xephi/authme/output/Messages.java @@ -2,7 +2,7 @@ package fr.xephi.authme.output; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.initialization.SettingsDependent; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.util.StringUtils; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; @@ -30,7 +30,7 @@ public class Messages implements SettingsDependent { * @param settings The settings */ @Inject - Messages(NewSetting settings) { + Messages(Settings settings) { reload(settings); this.defaultFile = settings.getDefaultMessagesFile(); } @@ -118,7 +118,7 @@ public class Messages implements SettingsDependent { } @Override - public void reload(NewSetting settings) { + public void reload(Settings settings) { File messageFile = settings.getMessagesFile(); this.configuration = YamlConfiguration.loadConfiguration(messageFile); this.fileName = messageFile.getName(); diff --git a/src/main/java/fr/xephi/authme/permission/AuthGroupHandler.java b/src/main/java/fr/xephi/authme/permission/AuthGroupHandler.java index 6042bf81d..7d2136f00 100644 --- a/src/main/java/fr/xephi/authme/permission/AuthGroupHandler.java +++ b/src/main/java/fr/xephi/authme/permission/AuthGroupHandler.java @@ -4,7 +4,7 @@ import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.PlayerData; import fr.xephi.authme.initialization.Reloadable; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.HooksSettings; import fr.xephi.authme.settings.properties.PluginSettings; import fr.xephi.authme.settings.properties.SecuritySettings; @@ -22,7 +22,7 @@ public class AuthGroupHandler implements Reloadable { private PermissionsManager permissionsManager; @Inject - private NewSetting settings; + private Settings settings; @Inject private LimboCache limboCache; diff --git a/src/main/java/fr/xephi/authme/process/ProcessService.java b/src/main/java/fr/xephi/authme/process/ProcessService.java index fd2e5657a..db5b4211e 100644 --- a/src/main/java/fr/xephi/authme/process/ProcessService.java +++ b/src/main/java/fr/xephi/authme/process/ProcessService.java @@ -6,7 +6,7 @@ import fr.xephi.authme.permission.AuthGroupHandler; import fr.xephi.authme.permission.AuthGroupType; import fr.xephi.authme.permission.PermissionNode; import fr.xephi.authme.permission.PermissionsManager; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.domain.Property; import fr.xephi.authme.util.ValidationService; import org.bukkit.command.CommandSender; @@ -20,7 +20,7 @@ import javax.inject.Inject; public class ProcessService { @Inject - private NewSetting settings; + private Settings settings; @Inject private Messages messages; @@ -50,7 +50,7 @@ public class ProcessService { * * @return settings manager */ - public NewSetting getSettings() { + public Settings getSettings() { return settings; } diff --git a/src/main/java/fr/xephi/authme/security/PasswordSecurity.java b/src/main/java/fr/xephi/authme/security/PasswordSecurity.java index 819b15f2d..521decfae 100644 --- a/src/main/java/fr/xephi/authme/security/PasswordSecurity.java +++ b/src/main/java/fr/xephi/authme/security/PasswordSecurity.java @@ -6,7 +6,7 @@ import fr.xephi.authme.events.PasswordEncryptionEvent; import fr.xephi.authme.initialization.Reloadable; import fr.xephi.authme.security.crypts.EncryptionMethod; import fr.xephi.authme.security.crypts.HashedPassword; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.SecuritySettings; import org.bukkit.plugin.PluginManager; @@ -19,7 +19,7 @@ import javax.inject.Inject; public class PasswordSecurity implements Reloadable { @Inject - private NewSetting settings; + private Settings settings; @Inject private DataSource dataSource; diff --git a/src/main/java/fr/xephi/authme/security/crypts/BCRYPT.java b/src/main/java/fr/xephi/authme/security/crypts/BCRYPT.java index e8bd8f654..4a4f92f33 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/BCRYPT.java +++ b/src/main/java/fr/xephi/authme/security/crypts/BCRYPT.java @@ -5,7 +5,7 @@ import fr.xephi.authme.security.crypts.description.HasSalt; import fr.xephi.authme.security.crypts.description.Recommendation; import fr.xephi.authme.security.crypts.description.SaltType; import fr.xephi.authme.security.crypts.description.Usage; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.HooksSettings; import fr.xephi.authme.util.StringUtils; @@ -18,7 +18,7 @@ public class BCRYPT implements EncryptionMethod { private final int bCryptLog2Rounds; @Inject - public BCRYPT(NewSetting settings) { + public BCRYPT(Settings settings) { bCryptLog2Rounds = settings.getProperty(HooksSettings.BCRYPT_LOG2_ROUND); } diff --git a/src/main/java/fr/xephi/authme/security/crypts/SALTED2MD5.java b/src/main/java/fr/xephi/authme/security/crypts/SALTED2MD5.java index a96cc0d5e..2b683bb25 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/SALTED2MD5.java +++ b/src/main/java/fr/xephi/authme/security/crypts/SALTED2MD5.java @@ -5,7 +5,7 @@ import fr.xephi.authme.security.crypts.description.HasSalt; import fr.xephi.authme.security.crypts.description.Recommendation; import fr.xephi.authme.security.crypts.description.SaltType; import fr.xephi.authme.security.crypts.description.Usage; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.SecuritySettings; import javax.inject.Inject; @@ -19,7 +19,7 @@ public class SALTED2MD5 extends SeparateSaltMethod { private final int saltLength; @Inject - public SALTED2MD5(NewSetting settings) { + public SALTED2MD5(Settings settings) { saltLength = settings.getProperty(SecuritySettings.DOUBLE_MD5_SALT_LENGTH); } diff --git a/src/main/java/fr/xephi/authme/service/BungeeService.java b/src/main/java/fr/xephi/authme/service/BungeeService.java index c765c12a7..197b96ad1 100644 --- a/src/main/java/fr/xephi/authme/service/BungeeService.java +++ b/src/main/java/fr/xephi/authme/service/BungeeService.java @@ -5,7 +5,7 @@ import com.google.common.io.ByteStreams; import fr.xephi.authme.AuthMe; import fr.xephi.authme.initialization.SettingsDependent; import fr.xephi.authme.security.crypts.HashedPassword; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.HooksSettings; import fr.xephi.authme.util.BukkitService; import org.bukkit.entity.Player; @@ -30,7 +30,7 @@ public class BungeeService implements SettingsDependent { * @param settings AuthMe settings. */ @Inject - BungeeService(AuthMe plugin, BukkitService bukkitService, NewSetting settings) { + BungeeService(AuthMe plugin, BukkitService bukkitService, Settings settings) { this.plugin = plugin; this.bukkitService = bukkitService; reload(settings); @@ -100,7 +100,7 @@ public class BungeeService implements SettingsDependent { } @Override - public void reload(NewSetting settings) { + public void reload(Settings settings) { this.isEnabled = settings.getProperty(HooksSettings.BUNGEECORD); this.bungeeServer = settings.getProperty(HooksSettings.BUNGEECORD_SERVER); } diff --git a/src/main/java/fr/xephi/authme/settings/NewSetting.java b/src/main/java/fr/xephi/authme/settings/Settings.java similarity index 96% rename from src/main/java/fr/xephi/authme/settings/NewSetting.java rename to src/main/java/fr/xephi/authme/settings/Settings.java index 90719daaf..35b320d02 100644 --- a/src/main/java/fr/xephi/authme/settings/NewSetting.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -28,9 +28,9 @@ import java.util.Map; import static fr.xephi.authme.util.FileUtils.copyFileFromResource; /** - * The new settings manager. + * The AuthMe settings manager. */ -public class NewSetting { +public class Settings { private final File pluginFolder; private final File configFile; @@ -50,8 +50,8 @@ public class NewSetting { * @param propertyMap Collection of all available settings * @param migrationService Migration service to check the settings file with */ - public NewSetting(File configFile, File pluginFolder, PropertyMap propertyMap, - SettingsMigrationService migrationService) { + public Settings(File configFile, File pluginFolder, PropertyMap propertyMap, + SettingsMigrationService migrationService) { this.configuration = YamlConfiguration.loadConfiguration(configFile); this.configFile = configFile; this.pluginFolder = pluginFolder; @@ -70,8 +70,8 @@ public class NewSetting { * @param migrationService Migration service, or null to skip migration checks */ @VisibleForTesting - NewSetting(FileConfiguration configuration, File configFile, File pluginFolder, PropertyMap propertyMap, - SettingsMigrationService migrationService) { + Settings(FileConfiguration configuration, File configFile, File pluginFolder, PropertyMap propertyMap, + SettingsMigrationService migrationService) { this.configuration = configuration; this.configFile = configFile; this.pluginFolder = pluginFolder; diff --git a/src/main/java/fr/xephi/authme/settings/SpawnLoader.java b/src/main/java/fr/xephi/authme/settings/SpawnLoader.java index 9295ba81e..3345ef8df 100644 --- a/src/main/java/fr/xephi/authme/settings/SpawnLoader.java +++ b/src/main/java/fr/xephi/authme/settings/SpawnLoader.java @@ -31,7 +31,7 @@ import java.io.IOException; public class SpawnLoader implements Reloadable { private final File authMeConfigurationFile; - private final NewSetting settings; + private final Settings settings; private final PluginHooks pluginHooks; private FileConfiguration authMeConfiguration; private String[] spawnPriority; @@ -46,7 +46,7 @@ public class SpawnLoader implements Reloadable { * @param dataSource The plugin auth database instance */ @Inject - SpawnLoader(@DataFolder File pluginFolder, NewSetting settings, PluginHooks pluginHooks, + SpawnLoader(@DataFolder File pluginFolder, Settings settings, PluginHooks pluginHooks, DataSource dataSource) { File spawnFile = new File(pluginFolder, "spawn.yml"); // TODO ljacqu 20160312: Check if resource could be copied and handle the case if not diff --git a/src/main/java/fr/xephi/authme/task/PlayerDataTaskManager.java b/src/main/java/fr/xephi/authme/task/PlayerDataTaskManager.java index b89043232..b4e1846d2 100644 --- a/src/main/java/fr/xephi/authme/task/PlayerDataTaskManager.java +++ b/src/main/java/fr/xephi/authme/task/PlayerDataTaskManager.java @@ -6,7 +6,7 @@ import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.PlayerData; import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.Messages; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.RegistrationSettings; import fr.xephi.authme.settings.properties.RestrictionSettings; import fr.xephi.authme.util.BukkitService; @@ -26,7 +26,7 @@ public class PlayerDataTaskManager { private Messages messages; @Inject - private NewSetting settings; + private Settings settings; @Inject private BukkitService bukkitService; diff --git a/src/main/java/fr/xephi/authme/task/purge/PurgeExecutor.java b/src/main/java/fr/xephi/authme/task/purge/PurgeExecutor.java index a88052382..2fb65fdd2 100644 --- a/src/main/java/fr/xephi/authme/task/purge/PurgeExecutor.java +++ b/src/main/java/fr/xephi/authme/task/purge/PurgeExecutor.java @@ -4,7 +4,7 @@ import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.hooks.PluginHooks; import fr.xephi.authme.permission.PermissionsManager; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.PurgeSettings; import fr.xephi.authme.util.BukkitService; import fr.xephi.authme.util.Utils; @@ -24,7 +24,7 @@ import static fr.xephi.authme.util.StringUtils.makePath; class PurgeExecutor { @Inject - private NewSetting settings; + private Settings settings; @Inject private DataSource dataSource; diff --git a/src/main/java/fr/xephi/authme/task/purge/PurgeService.java b/src/main/java/fr/xephi/authme/task/purge/PurgeService.java index 8f6f42f7f..f8c33e4c7 100644 --- a/src/main/java/fr/xephi/authme/task/purge/PurgeService.java +++ b/src/main/java/fr/xephi/authme/task/purge/PurgeService.java @@ -3,7 +3,7 @@ package fr.xephi.authme.task.purge; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.permission.PermissionsManager; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.PurgeSettings; import fr.xephi.authme.util.BukkitService; import fr.xephi.authme.util.CollectionUtils; @@ -25,7 +25,7 @@ public class PurgeService { private DataSource dataSource; @Inject - private NewSetting settings; + private Settings settings; @Inject private PermissionsManager permissionsManager; diff --git a/src/main/java/fr/xephi/authme/util/MigrationService.java b/src/main/java/fr/xephi/authme/util/MigrationService.java index 8f786287e..cc0ef72a4 100644 --- a/src/main/java/fr/xephi/authme/util/MigrationService.java +++ b/src/main/java/fr/xephi/authme/util/MigrationService.java @@ -10,7 +10,7 @@ import fr.xephi.authme.datasource.SQLite; import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.security.crypts.HashedPassword; import fr.xephi.authme.security.crypts.SHA256; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.DatabaseSettings; import fr.xephi.authme.settings.properties.SecuritySettings; @@ -31,7 +31,7 @@ public final class MigrationService { * @param dataSource The data source * @param authmeSha256 Instance to the AuthMe SHA256 encryption method implementation */ - public static void changePlainTextToSha256(NewSetting settings, DataSource dataSource, + public static void changePlainTextToSha256(Settings settings, DataSource dataSource, SHA256 authmeSha256) { if (HashAlgorithm.PLAINTEXT == settings.getProperty(SecuritySettings.PASSWORD_HASH)) { ConsoleLogger.warning("Your HashAlgorithm has been detected as plaintext and is now deprecated;" @@ -61,7 +61,7 @@ public final class MigrationService { * @param dataSource The data source * @return The converted datasource (SQLite), or null if no migration was necessary */ - public static DataSource convertFlatfileToSqlite(NewSetting settings, DataSource dataSource) { + public static DataSource convertFlatfileToSqlite(Settings settings, DataSource dataSource) { if (DataSourceType.FILE == settings.getProperty(DatabaseSettings.BACKEND)) { ConsoleLogger.warning("FlatFile backend has been detected and is now deprecated; it will be changed " + "to SQLite... Connection will be impossible until conversion is done!"); diff --git a/src/main/java/fr/xephi/authme/util/TeleportationService.java b/src/main/java/fr/xephi/authme/util/TeleportationService.java index d8d84292a..25f5b1d11 100644 --- a/src/main/java/fr/xephi/authme/util/TeleportationService.java +++ b/src/main/java/fr/xephi/authme/util/TeleportationService.java @@ -10,7 +10,7 @@ import fr.xephi.authme.events.AuthMeTeleportEvent; import fr.xephi.authme.events.FirstSpawnTeleportEvent; import fr.xephi.authme.events.SpawnTeleportEvent; import fr.xephi.authme.initialization.Reloadable; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.SpawnLoader; import fr.xephi.authme.settings.properties.RestrictionSettings; import org.bukkit.Location; @@ -30,7 +30,7 @@ import static fr.xephi.authme.settings.properties.RestrictionSettings.TELEPORT_U public class TeleportationService implements Reloadable { @Inject - private NewSetting settings; + private Settings settings; @Inject private BukkitService bukkitService; diff --git a/src/main/java/fr/xephi/authme/util/ValidationService.java b/src/main/java/fr/xephi/authme/util/ValidationService.java index 283a3eb10..aae881a07 100644 --- a/src/main/java/fr/xephi/authme/util/ValidationService.java +++ b/src/main/java/fr/xephi/authme/util/ValidationService.java @@ -5,7 +5,7 @@ import fr.xephi.authme.initialization.Reloadable; import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.permission.PermissionsManager; import fr.xephi.authme.permission.PlayerStatePermission; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.domain.Property; import fr.xephi.authme.settings.properties.EmailSettings; import fr.xephi.authme.settings.properties.ProtectionSettings; @@ -27,7 +27,7 @@ import java.util.regex.Pattern; public class ValidationService implements Reloadable { @Inject - private NewSetting settings; + private Settings settings; @Inject private DataSource dataSource; @Inject diff --git a/src/test/java/fr/xephi/authme/AntiBotTest.java b/src/test/java/fr/xephi/authme/AntiBotTest.java index ddf418314..736e428c3 100644 --- a/src/test/java/fr/xephi/authme/AntiBotTest.java +++ b/src/test/java/fr/xephi/authme/AntiBotTest.java @@ -4,7 +4,7 @@ import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.Messages; import fr.xephi.authme.permission.PermissionsManager; import fr.xephi.authme.permission.PlayerStatePermission; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.ProtectionSettings; import fr.xephi.authme.util.BukkitService; import org.bukkit.entity.Player; @@ -41,7 +41,7 @@ import static org.mockito.Mockito.verify; public class AntiBotTest { @Mock - private NewSetting settings; + private Settings settings; @Mock private Messages messages; @Mock diff --git a/src/test/java/fr/xephi/authme/AuthMeInitializationTest.java b/src/test/java/fr/xephi/authme/AuthMeInitializationTest.java index 9ec1cbdee..9c0036f90 100644 --- a/src/test/java/fr/xephi/authme/AuthMeInitializationTest.java +++ b/src/test/java/fr/xephi/authme/AuthMeInitializationTest.java @@ -12,7 +12,7 @@ import fr.xephi.authme.permission.PermissionsManager; import fr.xephi.authme.process.Management; import fr.xephi.authme.process.login.ProcessSyncPlayerLogin; import fr.xephi.authme.security.PasswordSecurity; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.task.purge.PurgeService; import org.bukkit.Bukkit; import org.bukkit.Server; @@ -92,7 +92,7 @@ public class AuthMeInitializationTest { @Test public void shouldInitializeAllServices() { // given - NewSetting settings = new NewSetting(settingsFile, dataFolder, getAllPropertyFields(), alwaysFulfilled()); + Settings settings = new Settings(settingsFile, dataFolder, getAllPropertyFields(), alwaysFulfilled()); // TODO ljacqu 20160619: At some point setting the "plugin" field should no longer be necessary // We only require it right now because of usages of AuthMe#getInstance() @@ -104,7 +104,7 @@ public class AuthMeInitializationTest { injector.register(PluginManager.class, pluginManager); injector.register(AuthMe.class, authMe); - injector.register(NewSetting.class, settings); + injector.register(Settings.class, settings); injector.register(DataSource.class, mock(DataSource.class)); // when diff --git a/src/test/java/fr/xephi/authme/ConsoleLoggerTest.java b/src/test/java/fr/xephi/authme/ConsoleLoggerTest.java index 52a7a6463..ae53ee454 100644 --- a/src/test/java/fr/xephi/authme/ConsoleLoggerTest.java +++ b/src/test/java/fr/xephi/authme/ConsoleLoggerTest.java @@ -1,7 +1,7 @@ package fr.xephi.authme; import fr.xephi.authme.output.LogLevel; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.PluginSettings; import fr.xephi.authme.settings.properties.SecuritySettings; import fr.xephi.authme.util.StringUtils; @@ -45,7 +45,7 @@ public class ConsoleLoggerTest { private Logger logger; @Mock - private NewSetting settings; + private Settings settings; @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); @@ -144,8 +144,8 @@ public class ConsoleLoggerTest { TestHelper.validateHasOnlyPrivateEmptyConstructor(ConsoleLogger.class); } - private static NewSetting newSettings(boolean logToFile, LogLevel logLevel) { - NewSetting settings = mock(NewSetting.class); + private static Settings newSettings(boolean logToFile, LogLevel logLevel) { + Settings settings = mock(Settings.class); given(settings.getProperty(SecuritySettings.USE_LOGGING)).willReturn(logToFile); given(settings.getProperty(PluginSettings.LOG_LEVEL)).willReturn(logLevel); return settings; diff --git a/src/test/java/fr/xephi/authme/cache/CaptchaManagerTest.java b/src/test/java/fr/xephi/authme/cache/CaptchaManagerTest.java index f895f46e3..0a9f3b39a 100644 --- a/src/test/java/fr/xephi/authme/cache/CaptchaManagerTest.java +++ b/src/test/java/fr/xephi/authme/cache/CaptchaManagerTest.java @@ -1,7 +1,7 @@ package fr.xephi.authme.cache; import fr.xephi.authme.ReflectionTestUtils; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.SecuritySettings; import org.junit.Test; @@ -21,7 +21,7 @@ public class CaptchaManagerTest { @Test public void shouldAddCounts() { // given - NewSetting settings = mockSettings(3, 4); + Settings settings = mockSettings(3, 4); CaptchaManager manager = new CaptchaManager(settings); String player = "tester"; @@ -41,7 +41,7 @@ public class CaptchaManagerTest { public void shouldCreateAndCheckCaptcha() { // given String player = "Miner"; - NewSetting settings = mockSettings(1, 4); + Settings settings = mockSettings(1, 4); CaptchaManager manager = new CaptchaManager(settings); String captchaCode = manager.getCaptchaCodeOrGenerateNew(player); @@ -66,7 +66,7 @@ public class CaptchaManagerTest { public void shouldHaveSameCodeAfterGeneration() { // given String player = "Tester"; - NewSetting settings = mockSettings(1, 5); + Settings settings = mockSettings(1, 5); CaptchaManager manager = new CaptchaManager(settings); // when @@ -88,7 +88,7 @@ public class CaptchaManagerTest { public void shouldIncreaseAndResetCount() { // given String player = "plaYer"; - NewSetting settings = mockSettings(2, 3); + Settings settings = mockSettings(2, 3); CaptchaManager manager = new CaptchaManager(settings); // when @@ -111,7 +111,7 @@ public class CaptchaManagerTest { public void shouldNotIncreaseCountForDisabledCaptcha() { // given String player = "someone_"; - NewSetting settings = mockSettings(1, 3); + Settings settings = mockSettings(1, 3); given(settings.getProperty(SecuritySettings.USE_CAPTCHA)).willReturn(false); CaptchaManager manager = new CaptchaManager(settings); @@ -127,7 +127,7 @@ public class CaptchaManagerTest { public void shouldNotCheckCountIfCaptchaIsDisabled() { // given String player = "Robert001"; - NewSetting settings = mockSettings(1, 5); + Settings settings = mockSettings(1, 5); CaptchaManager manager = new CaptchaManager(settings); given(settings.getProperty(SecuritySettings.USE_CAPTCHA)).willReturn(false); @@ -144,8 +144,8 @@ public class CaptchaManagerTest { assertThat(result, equalTo(false)); } - private static NewSetting mockSettings(int maxTries, int captchaLength) { - NewSetting settings = mock(NewSetting.class); + private static Settings mockSettings(int maxTries, int captchaLength) { + Settings settings = mock(Settings.class); given(settings.getProperty(SecuritySettings.USE_CAPTCHA)).willReturn(true); given(settings.getProperty(SecuritySettings.MAX_LOGIN_TRIES_BEFORE_CAPTCHA)).willReturn(maxTries); given(settings.getProperty(SecuritySettings.CAPTCHA_LENGTH)).willReturn(captchaLength); diff --git a/src/test/java/fr/xephi/authme/cache/SessionManagerTest.java b/src/test/java/fr/xephi/authme/cache/SessionManagerTest.java index 7e9fffbb8..aa3ae5505 100644 --- a/src/test/java/fr/xephi/authme/cache/SessionManagerTest.java +++ b/src/test/java/fr/xephi/authme/cache/SessionManagerTest.java @@ -1,7 +1,7 @@ package fr.xephi.authme.cache; import fr.xephi.authme.ReflectionTestUtils; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.PluginSettings; import org.junit.Test; import org.junit.runner.RunWith; @@ -24,7 +24,7 @@ public class SessionManagerTest { @Test public void shouldHaveSession() { // given - NewSetting settings = mockSettings(true, 10); + Settings settings = mockSettings(true, 10); SessionManager manager = new SessionManager(settings); String player = "playah"; @@ -38,7 +38,7 @@ public class SessionManagerTest { @Test public void shouldNotHaveSession() { // given - NewSetting settings = mockSettings(true, 10); + Settings settings = mockSettings(true, 10); SessionManager manager = new SessionManager(settings); String player = "playah"; @@ -49,7 +49,7 @@ public class SessionManagerTest { @Test public void shouldNotAddSessionBecauseDisabled() { // given - NewSetting settings = mockSettings(false, 10); + Settings settings = mockSettings(false, 10); SessionManager manager = new SessionManager(settings); String player = "playah"; @@ -63,7 +63,7 @@ public class SessionManagerTest { @Test public void shouldNotAddSessionBecauseTimeoutIsZero() { // given - NewSetting settings = mockSettings(true, 0); + Settings settings = mockSettings(true, 0); SessionManager manager = new SessionManager(settings); String player = "playah"; @@ -77,7 +77,7 @@ public class SessionManagerTest { @Test public void shouldRemoveSession() { // given - NewSetting settings = mockSettings(true, 10); + Settings settings = mockSettings(true, 10); String player = "user"; SessionManager manager = new SessionManager(settings); manager.addSession(player); @@ -93,7 +93,7 @@ public class SessionManagerTest { public void shouldDenySessionIfTimeoutHasExpired() { // given int timeout = 20; - NewSetting settings = mockSettings(true, timeout); + Settings settings = mockSettings(true, timeout); String player = "patrick"; SessionManager manager = new SessionManager(settings); Map sessions = getSessionsMap(manager); @@ -110,7 +110,7 @@ public class SessionManagerTest { @Test public void shouldClearAllSessionsAfterDisable() { // given - NewSetting settings = mockSettings(true, 10); + Settings settings = mockSettings(true, 10); SessionManager manager = new SessionManager(settings); manager.addSession("player01"); manager.addSession("player02"); @@ -129,8 +129,8 @@ public class SessionManagerTest { } - private static NewSetting mockSettings(boolean isEnabled, int sessionTimeout) { - NewSetting settings = mock(NewSetting.class); + private static Settings mockSettings(boolean isEnabled, int sessionTimeout) { + Settings settings = mock(Settings.class); given(settings.getProperty(PluginSettings.SESSIONS_ENABLED)).willReturn(isEnabled); given(settings.getProperty(PluginSettings.SESSIONS_TIMEOUT)).willReturn(sessionTimeout); return settings; diff --git a/src/test/java/fr/xephi/authme/cache/TempbanManagerTest.java b/src/test/java/fr/xephi/authme/cache/TempbanManagerTest.java index b526d17c1..7435512df 100644 --- a/src/test/java/fr/xephi/authme/cache/TempbanManagerTest.java +++ b/src/test/java/fr/xephi/authme/cache/TempbanManagerTest.java @@ -4,7 +4,7 @@ import fr.xephi.authme.ReflectionTestUtils; import fr.xephi.authme.TestHelper; import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.Messages; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.SecuritySettings; import fr.xephi.authme.util.BukkitService; import org.bukkit.entity.Player; @@ -44,7 +44,7 @@ public class TempbanManagerTest { @Test public void shouldAddCounts() { // given - NewSetting settings = mockSettings(3, 60); + Settings settings = mockSettings(3, 60); TempbanManager manager = new TempbanManager(bukkitService, messages, settings); String address = "192.168.1.1"; @@ -64,7 +64,7 @@ public class TempbanManagerTest { public void shouldIncreaseAndResetCount() { // given String address = "192.168.1.2"; - NewSetting settings = mockSettings(3, 60); + Settings settings = mockSettings(3, 60); TempbanManager manager = new TempbanManager(bukkitService, messages, settings); // when @@ -88,7 +88,7 @@ public class TempbanManagerTest { public void shouldNotIncreaseCountForDisabledTempban() { // given String address = "192.168.1.3"; - NewSetting settings = mockSettings(1, 5); + Settings settings = mockSettings(1, 5); given(settings.getProperty(SecuritySettings.TEMPBAN_ON_MAX_LOGINS)).willReturn(false); TempbanManager manager = new TempbanManager(bukkitService, messages, settings); @@ -104,7 +104,7 @@ public class TempbanManagerTest { public void shouldNotCheckCountIfTempbanIsDisabled() { // given String address = "192.168.1.4"; - NewSetting settings = mockSettings(1, 5); + Settings settings = mockSettings(1, 5); TempbanManager manager = new TempbanManager(bukkitService, messages, settings); given(settings.getProperty(SecuritySettings.TEMPBAN_ON_MAX_LOGINS)).willReturn(false); @@ -124,7 +124,7 @@ public class TempbanManagerTest { @Test public void shouldNotIssueBanIfDisabled() { // given - NewSetting settings = mockSettings(0, 0); + Settings settings = mockSettings(0, 0); given(settings.getProperty(SecuritySettings.TEMPBAN_ON_MAX_LOGINS)).willReturn(false); Player player = mock(Player.class); TempbanManager manager = new TempbanManager(bukkitService, messages, settings); @@ -144,7 +144,7 @@ public class TempbanManagerTest { TestHelper.mockPlayerIp(player, ip); String banReason = "IP ban too many logins"; given(messages.retrieveSingle(MessageKey.TEMPBAN_MAX_LOGINS)).willReturn(banReason); - NewSetting settings = mockSettings(2, 100); + Settings settings = mockSettings(2, 100); TempbanManager manager = new TempbanManager(bukkitService, messages, settings); // when @@ -171,7 +171,7 @@ public class TempbanManagerTest { TestHelper.mockPlayerIp(player, ip); String banReason = "kick msg"; given(messages.retrieveSingle(MessageKey.TEMPBAN_MAX_LOGINS)).willReturn(banReason); - NewSetting settings = mockSettings(10, 60); + Settings settings = mockSettings(10, 60); TempbanManager manager = new TempbanManager(bukkitService, messages, settings); manager.increaseCount(ip); manager.increaseCount(ip); @@ -186,8 +186,8 @@ public class TempbanManagerTest { assertHasCount(manager, ip, null); } - private static NewSetting mockSettings(int maxTries, int tempbanLength) { - NewSetting settings = mock(NewSetting.class); + private static Settings mockSettings(int maxTries, int tempbanLength) { + Settings settings = mock(Settings.class); given(settings.getProperty(SecuritySettings.TEMPBAN_ON_MAX_LOGINS)).willReturn(true); given(settings.getProperty(SecuritySettings.MAX_LOGIN_TEMPBAN)).willReturn(maxTries); given(settings.getProperty(SecuritySettings.TEMPBAN_LENGTH)).willReturn(tempbanLength); diff --git a/src/test/java/fr/xephi/authme/cache/limbo/LimboCacheTest.java b/src/test/java/fr/xephi/authme/cache/limbo/LimboCacheTest.java index 7d129271e..ef66a21fb 100644 --- a/src/test/java/fr/xephi/authme/cache/limbo/LimboCacheTest.java +++ b/src/test/java/fr/xephi/authme/cache/limbo/LimboCacheTest.java @@ -3,7 +3,7 @@ package fr.xephi.authme.cache.limbo; import fr.xephi.authme.ReflectionTestUtils; import fr.xephi.authme.cache.backup.PlayerDataStorage; import fr.xephi.authme.permission.PermissionsManager; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.SpawnLoader; import fr.xephi.authme.settings.properties.PluginSettings; import org.bukkit.Location; @@ -35,7 +35,7 @@ public class LimboCacheTest { private LimboCache limboCache; @Mock - private NewSetting settings; + private Settings settings; @Mock private PermissionsManager permissionsManager; diff --git a/src/test/java/fr/xephi/authme/command/CommandServiceTest.java b/src/test/java/fr/xephi/authme/command/CommandServiceTest.java index 3a3b5312d..76fed3a32 100644 --- a/src/test/java/fr/xephi/authme/command/CommandServiceTest.java +++ b/src/test/java/fr/xephi/authme/command/CommandServiceTest.java @@ -2,7 +2,7 @@ package fr.xephi.authme.command; import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.Messages; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.domain.Property; import fr.xephi.authme.settings.properties.SecuritySettings; import fr.xephi.authme.util.ValidationService; @@ -31,7 +31,7 @@ public class CommandServiceTest { @Mock private Messages messages; @Mock - private NewSetting settings; + private Settings settings; @Mock private ValidationService validationService; @@ -91,7 +91,7 @@ public class CommandServiceTest { @Test public void shouldReturnSettings() { // given/when - NewSetting result = commandService.getSettings(); + Settings result = commandService.getSettings(); // then assertThat(result, equalTo(settings)); diff --git a/src/test/java/fr/xephi/authme/command/executable/authme/ReloadCommandTest.java b/src/test/java/fr/xephi/authme/command/executable/authme/ReloadCommandTest.java index b3e192ecc..5eb7dcc6d 100644 --- a/src/test/java/fr/xephi/authme/command/executable/authme/ReloadCommandTest.java +++ b/src/test/java/fr/xephi/authme/command/executable/authme/ReloadCommandTest.java @@ -10,7 +10,7 @@ import fr.xephi.authme.initialization.Reloadable; import fr.xephi.authme.initialization.SettingsDependent; import fr.xephi.authme.output.LogLevel; import fr.xephi.authme.output.MessageKey; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.DatabaseSettings; import fr.xephi.authme.settings.properties.PluginSettings; import fr.xephi.authme.settings.properties.SecuritySettings; @@ -53,7 +53,7 @@ public class ReloadCommandTest { private Injector injector; @Mock - private NewSetting settings; + private Settings settings; @Mock private DataSource dataSource; diff --git a/src/test/java/fr/xephi/authme/command/help/HelpProviderTest.java b/src/test/java/fr/xephi/authme/command/help/HelpProviderTest.java index b5450fb0c..f75e5c083 100644 --- a/src/test/java/fr/xephi/authme/command/help/HelpProviderTest.java +++ b/src/test/java/fr/xephi/authme/command/help/HelpProviderTest.java @@ -6,7 +6,7 @@ import fr.xephi.authme.command.FoundResultStatus; import fr.xephi.authme.command.TestCommandsUtil; import fr.xephi.authme.permission.AdminPermission; import fr.xephi.authme.permission.PermissionsManager; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.PluginSettings; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; @@ -57,7 +57,7 @@ public class HelpProviderTest { @Before public void setUpHelpProvider() { permissionsManager = mock(PermissionsManager.class); - NewSetting settings = mock(NewSetting.class); + Settings settings = mock(Settings.class); given(settings.getProperty(PluginSettings.HELP_HEADER)).willReturn(HELP_HEADER); helpProvider = new HelpProvider(permissionsManager, settings); sender = mock(CommandSender.class); diff --git a/src/test/java/fr/xephi/authme/converter/CrazyLoginConverterTest.java b/src/test/java/fr/xephi/authme/converter/CrazyLoginConverterTest.java index d3005cb26..0049a0286 100644 --- a/src/test/java/fr/xephi/authme/converter/CrazyLoginConverterTest.java +++ b/src/test/java/fr/xephi/authme/converter/CrazyLoginConverterTest.java @@ -6,7 +6,7 @@ import fr.xephi.authme.TestHelper; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.initialization.DataFolder; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.ConverterSettings; import org.bukkit.command.CommandSender; import org.junit.BeforeClass; @@ -42,7 +42,7 @@ public class CrazyLoginConverterTest { private DataSource dataSource; @Mock - private NewSetting settings; + private Settings settings; @DataFolder private File dataFolder = TestHelper.getJarFile(TestHelper.PROJECT_ROOT + "converter/"); diff --git a/src/test/java/fr/xephi/authme/datasource/AbstractResourceClosingTest.java b/src/test/java/fr/xephi/authme/datasource/AbstractResourceClosingTest.java index d692d78d7..62f48f138 100644 --- a/src/test/java/fr/xephi/authme/datasource/AbstractResourceClosingTest.java +++ b/src/test/java/fr/xephi/authme/datasource/AbstractResourceClosingTest.java @@ -8,7 +8,7 @@ import fr.xephi.authme.TestHelper; import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.security.crypts.HashedPassword; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.domain.Property; import fr.xephi.authme.settings.properties.SecuritySettings; import org.junit.Before; @@ -72,7 +72,7 @@ public abstract class AbstractResourceClosingTest { private static final Map CUSTOM_ALGORITHMS = getCustomAlgorithmList(); /** Mock of a settings instance. */ - private static NewSetting settings; + private static Settings settings; /** The datasource to test. */ private DataSource dataSource; @@ -101,7 +101,7 @@ public abstract class AbstractResourceClosingTest { @SuppressWarnings({ "unchecked", "rawtypes" }) @BeforeClass public static void initializeSettings() throws IOException, ClassNotFoundException { - settings = mock(NewSetting.class); + settings = mock(Settings.class); given(settings.getProperty(any(Property.class))).willAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) { @@ -152,7 +152,7 @@ public abstract class AbstractResourceClosingTest { } /* Create a DataSource instance with the given mock settings and mock connection. */ - protected abstract DataSource createDataSource(NewSetting settings, Connection connection) throws Exception; + protected abstract DataSource createDataSource(Settings settings, Connection connection) throws Exception; /* Get all methods of the DataSource interface, minus the ones in the ignored list. */ private static List getDataSourceMethods() { diff --git a/src/test/java/fr/xephi/authme/datasource/MySqlIntegrationTest.java b/src/test/java/fr/xephi/authme/datasource/MySqlIntegrationTest.java index 8289d8373..232f7a631 100644 --- a/src/test/java/fr/xephi/authme/datasource/MySqlIntegrationTest.java +++ b/src/test/java/fr/xephi/authme/datasource/MySqlIntegrationTest.java @@ -3,7 +3,7 @@ package fr.xephi.authme.datasource; import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import fr.xephi.authme.TestHelper; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.domain.Property; import fr.xephi.authme.settings.properties.DatabaseSettings; import org.junit.After; @@ -29,7 +29,7 @@ import static org.mockito.Mockito.when; public class MySqlIntegrationTest extends AbstractDataSourceIntegrationTest { /** Mock of a settings instance. */ - private static NewSetting settings; + private static Settings settings; /** SQL statement to execute before running a test. */ private static String sqlInitialize; /** Connection to the H2 test database. */ @@ -44,7 +44,7 @@ public class MySqlIntegrationTest extends AbstractDataSourceIntegrationTest { // Check that we have an H2 driver Class.forName("org.h2.jdbcx.JdbcDataSource"); - settings = mock(NewSetting.class); + settings = mock(Settings.class); when(settings.getProperty(any(Property.class))).thenAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { diff --git a/src/test/java/fr/xephi/authme/datasource/MySqlResourceClosingTest.java b/src/test/java/fr/xephi/authme/datasource/MySqlResourceClosingTest.java index 9986725ca..7dccb08b0 100644 --- a/src/test/java/fr/xephi/authme/datasource/MySqlResourceClosingTest.java +++ b/src/test/java/fr/xephi/authme/datasource/MySqlResourceClosingTest.java @@ -2,7 +2,7 @@ package fr.xephi.authme.datasource; import com.zaxxer.hikari.HikariDataSource; import fr.xephi.authme.security.HashAlgorithm; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import java.lang.reflect.Method; import java.sql.Connection; @@ -20,7 +20,7 @@ public class MySqlResourceClosingTest extends AbstractResourceClosingTest { } @Override - protected DataSource createDataSource(NewSetting settings, Connection connection) throws Exception { + protected DataSource createDataSource(Settings settings, Connection connection) throws Exception { HikariDataSource hikariDataSource = mock(HikariDataSource.class); given(hikariDataSource.getConnection()).willReturn(connection); return new MySQL(settings, hikariDataSource); diff --git a/src/test/java/fr/xephi/authme/datasource/SQLiteIntegrationTest.java b/src/test/java/fr/xephi/authme/datasource/SQLiteIntegrationTest.java index e672eb49e..d87bcfa48 100644 --- a/src/test/java/fr/xephi/authme/datasource/SQLiteIntegrationTest.java +++ b/src/test/java/fr/xephi/authme/datasource/SQLiteIntegrationTest.java @@ -2,7 +2,7 @@ package fr.xephi.authme.datasource; import fr.xephi.authme.TestHelper; import fr.xephi.authme.cache.auth.PlayerAuth; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.domain.Property; import fr.xephi.authme.settings.properties.DatabaseSettings; import org.junit.After; @@ -32,7 +32,7 @@ import static org.mockito.Mockito.when; public class SQLiteIntegrationTest extends AbstractDataSourceIntegrationTest { /** Mock of a settings instance. */ - private static NewSetting settings; + private static Settings settings; /** Collection of SQL statements to execute for initialization of a test. */ private static String[] sqlInitialize; /** Connection to the SQLite test database. */ @@ -47,7 +47,7 @@ public class SQLiteIntegrationTest extends AbstractDataSourceIntegrationTest { // Check that we have an implementation for SQLite Class.forName("org.sqlite.JDBC"); - settings = mock(NewSetting.class); + settings = mock(Settings.class); when(settings.getProperty(any(Property.class))).thenAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { diff --git a/src/test/java/fr/xephi/authme/datasource/SQLiteResourceClosingTest.java b/src/test/java/fr/xephi/authme/datasource/SQLiteResourceClosingTest.java index 3275aafae..9eac94630 100644 --- a/src/test/java/fr/xephi/authme/datasource/SQLiteResourceClosingTest.java +++ b/src/test/java/fr/xephi/authme/datasource/SQLiteResourceClosingTest.java @@ -1,7 +1,7 @@ package fr.xephi.authme.datasource; import fr.xephi.authme.security.HashAlgorithm; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import java.lang.reflect.Method; import java.sql.Connection; @@ -16,7 +16,7 @@ public class SQLiteResourceClosingTest extends AbstractResourceClosingTest { } @Override - protected DataSource createDataSource(NewSetting settings, Connection connection) throws Exception { + protected DataSource createDataSource(Settings settings, Connection connection) throws Exception { return new SQLite(settings, connection); } diff --git a/src/test/java/fr/xephi/authme/listener/ListenerServiceTest.java b/src/test/java/fr/xephi/authme/listener/ListenerServiceTest.java index 942158e9f..172768582 100644 --- a/src/test/java/fr/xephi/authme/listener/ListenerServiceTest.java +++ b/src/test/java/fr/xephi/authme/listener/ListenerServiceTest.java @@ -6,7 +6,7 @@ import ch.jalu.injector.testing.InjectDelayed; import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.hooks.PluginHooks; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.RegistrationSettings; import fr.xephi.authme.util.ValidationService; import org.bukkit.entity.Entity; @@ -35,7 +35,7 @@ public class ListenerServiceTest { private ListenerService listenerService; @Mock - private NewSetting settings; + private Settings settings; @Mock private DataSource dataSource; diff --git a/src/test/java/fr/xephi/authme/listener/OnJoinVerifierTest.java b/src/test/java/fr/xephi/authme/listener/OnJoinVerifierTest.java index 436f62f58..f2e9ee9eb 100644 --- a/src/test/java/fr/xephi/authme/listener/OnJoinVerifierTest.java +++ b/src/test/java/fr/xephi/authme/listener/OnJoinVerifierTest.java @@ -8,7 +8,7 @@ import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.Messages; import fr.xephi.authme.permission.PermissionsManager; import fr.xephi.authme.permission.PlayerStatePermission; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.RegistrationSettings; import fr.xephi.authme.settings.properties.RestrictionSettings; import fr.xephi.authme.util.BukkitService; @@ -53,7 +53,7 @@ public class OnJoinVerifierTest { private OnJoinVerifier onJoinVerifier; @Mock - private NewSetting settings; + private Settings settings; @Mock private DataSource dataSource; @Mock diff --git a/src/test/java/fr/xephi/authme/output/MessagesIntegrationTest.java b/src/test/java/fr/xephi/authme/output/MessagesIntegrationTest.java index 7b75a180c..ba8f03fb8 100644 --- a/src/test/java/fr/xephi/authme/output/MessagesIntegrationTest.java +++ b/src/test/java/fr/xephi/authme/output/MessagesIntegrationTest.java @@ -2,7 +2,7 @@ package fr.xephi.authme.output; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.TestHelper; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.junit.Before; @@ -53,7 +53,7 @@ public class MessagesIntegrationTest { @Before public void setUpMessages() { File testFile = TestHelper.getJarFile(YML_TEST_FILE); - NewSetting settings = mock(NewSetting.class); + Settings settings = mock(Settings.class); given(settings.getMessagesFile()).willReturn(testFile); given(settings.getDefaultMessagesFile()).willReturn(YML_DEFAULT_TEST_FILE); messages = new Messages(settings); @@ -235,7 +235,7 @@ public class MessagesIntegrationTest { @Test public void shouldAllowNullAsDefaultFile() { // given - NewSetting settings = mock(NewSetting.class); + Settings settings = mock(Settings.class); given(settings.getMessagesFile()).willReturn(TestHelper.getJarFile(YML_TEST_FILE)); Messages testMessages = new Messages(settings); // Key not present in test file @@ -254,7 +254,7 @@ public class MessagesIntegrationTest { MessageKey key = MessageKey.WRONG_PASSWORD; // assumption: message comes back as defined in messages_test.yml assumeThat(messages.retrieveSingle(key), equalTo("§cWrong password!")); - NewSetting settings = mock(NewSetting.class); + Settings settings = mock(Settings.class); given(settings.getMessagesFile()).willReturn(TestHelper.getJarFile( TestHelper.PROJECT_ROOT + "output/messages_test2.yml")); diff --git a/src/test/java/fr/xephi/authme/process/ProcessServiceTest.java b/src/test/java/fr/xephi/authme/process/ProcessServiceTest.java index 617e0d804..a1196c4d2 100644 --- a/src/test/java/fr/xephi/authme/process/ProcessServiceTest.java +++ b/src/test/java/fr/xephi/authme/process/ProcessServiceTest.java @@ -7,7 +7,7 @@ import fr.xephi.authme.permission.AuthGroupType; import fr.xephi.authme.permission.PermissionNode; import fr.xephi.authme.permission.PermissionsManager; import fr.xephi.authme.permission.PlayerPermission; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.SecuritySettings; import fr.xephi.authme.util.ValidationService; import org.bukkit.command.CommandSender; @@ -37,7 +37,7 @@ public class ProcessServiceTest { private ValidationService validationService; @Mock - private NewSetting settings; + private Settings settings; @Mock private Messages messages; @@ -64,7 +64,7 @@ public class ProcessServiceTest { @Test public void shouldReturnSettings() { // given/when - NewSetting result = processService.getSettings(); + Settings result = processService.getSettings(); // then assertThat(result, equalTo(settings)); diff --git a/src/test/java/fr/xephi/authme/security/HashAlgorithmIntegrationTest.java b/src/test/java/fr/xephi/authme/security/HashAlgorithmIntegrationTest.java index ea4cecc1a..fcfa4fad3 100644 --- a/src/test/java/fr/xephi/authme/security/HashAlgorithmIntegrationTest.java +++ b/src/test/java/fr/xephi/authme/security/HashAlgorithmIntegrationTest.java @@ -4,7 +4,7 @@ import ch.jalu.injector.Injector; import ch.jalu.injector.InjectorBuilder; import fr.xephi.authme.security.crypts.EncryptionMethod; import fr.xephi.authme.security.crypts.HashedPassword; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.HooksSettings; import fr.xephi.authme.settings.properties.SecuritySettings; import fr.xephi.authme.util.StringUtils; @@ -29,11 +29,11 @@ public class HashAlgorithmIntegrationTest { @BeforeClass public static void setUpConfigAndInjector() { - NewSetting settings = mock(NewSetting.class); + Settings settings = mock(Settings.class); given(settings.getProperty(HooksSettings.BCRYPT_LOG2_ROUND)).willReturn(8); given(settings.getProperty(SecuritySettings.DOUBLE_MD5_SALT_LENGTH)).willReturn(16); injector = new InjectorBuilder().addDefaultHandlers("fr.xephi.authme").create(); - injector.register(NewSetting.class, settings); + injector.register(Settings.class, settings); } @Test diff --git a/src/test/java/fr/xephi/authme/security/PasswordSecurityTest.java b/src/test/java/fr/xephi/authme/security/PasswordSecurityTest.java index 28e6c946e..064b27fa4 100644 --- a/src/test/java/fr/xephi/authme/security/PasswordSecurityTest.java +++ b/src/test/java/fr/xephi/authme/security/PasswordSecurityTest.java @@ -9,7 +9,7 @@ import fr.xephi.authme.events.PasswordEncryptionEvent; import fr.xephi.authme.security.crypts.EncryptionMethod; import fr.xephi.authme.security.crypts.HashedPassword; import fr.xephi.authme.security.crypts.JOOMLA; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.HooksSettings; import fr.xephi.authme.settings.properties.SecuritySettings; import org.bukkit.event.Event; @@ -45,7 +45,7 @@ public class PasswordSecurityTest { private Injector injector; @Mock - private NewSetting settings; + private Settings settings; @Mock private PluginManager pluginManager; @@ -81,7 +81,7 @@ public class PasswordSecurityTest { } }).when(pluginManager).callEvent(any(Event.class)); injector = new InjectorBuilder().addDefaultHandlers("!! impossible package !!").create(); - injector.register(NewSetting.class, settings); + injector.register(Settings.class, settings); injector.register(DataSource.class, dataSource); injector.register(PluginManager.class, pluginManager); } diff --git a/src/test/java/fr/xephi/authme/security/crypts/BcryptTest.java b/src/test/java/fr/xephi/authme/security/crypts/BcryptTest.java index d8b6aa023..3c0f1475a 100644 --- a/src/test/java/fr/xephi/authme/security/crypts/BcryptTest.java +++ b/src/test/java/fr/xephi/authme/security/crypts/BcryptTest.java @@ -1,7 +1,7 @@ package fr.xephi.authme.security.crypts; import fr.xephi.authme.TestHelper; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.HooksSettings; import org.junit.BeforeClass; @@ -27,8 +27,8 @@ public class BcryptTest extends AbstractEncryptionMethodTest { ); } - private static NewSetting mockSettings() { - NewSetting settings = mock(NewSetting.class); + private static Settings mockSettings() { + Settings settings = mock(Settings.class); given(settings.getProperty(HooksSettings.BCRYPT_LOG2_ROUND)).willReturn(8); return settings; } diff --git a/src/test/java/fr/xephi/authme/security/crypts/SALTED2MD5Test.java b/src/test/java/fr/xephi/authme/security/crypts/SALTED2MD5Test.java index fb51fabff..20ec99fe8 100644 --- a/src/test/java/fr/xephi/authme/security/crypts/SALTED2MD5Test.java +++ b/src/test/java/fr/xephi/authme/security/crypts/SALTED2MD5Test.java @@ -1,6 +1,6 @@ package fr.xephi.authme.security.crypts; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.SecuritySettings; import static org.mockito.BDDMockito.given; @@ -19,8 +19,8 @@ public class SALTED2MD5Test extends AbstractEncryptionMethodTest { new HashedPassword("ad25606eae5b760c8a2469d65578ac39", "04eee598")); // âË_3(íù*) } - private static NewSetting mockSettings() { - NewSetting settings = mock(NewSetting.class); + private static Settings mockSettings() { + Settings settings = mock(Settings.class); given(settings.getProperty(SecuritySettings.DOUBLE_MD5_SALT_LENGTH)).willReturn(8); return settings; } diff --git a/src/test/java/fr/xephi/authme/settings/ConfigFileConsistencyTest.java b/src/test/java/fr/xephi/authme/settings/ConfigFileConsistencyTest.java index 1ce7ec41f..cd66a8013 100644 --- a/src/test/java/fr/xephi/authme/settings/ConfigFileConsistencyTest.java +++ b/src/test/java/fr/xephi/authme/settings/ConfigFileConsistencyTest.java @@ -23,7 +23,7 @@ import static org.junit.Assert.assertThat; import static org.junit.Assert.fail; /** - * Test for {@link NewSetting} and the project's config.yml, + * Test for {@link Settings} and the project's config.yml, * verifying that no settings are missing from the file. */ public class ConfigFileConsistencyTest { diff --git a/src/test/java/fr/xephi/authme/settings/NewSettingIntegrationTest.java b/src/test/java/fr/xephi/authme/settings/SettingsIntegrationTest.java similarity index 92% rename from src/test/java/fr/xephi/authme/settings/NewSettingIntegrationTest.java rename to src/test/java/fr/xephi/authme/settings/SettingsIntegrationTest.java index 4663b2145..fd1f73013 100644 --- a/src/test/java/fr/xephi/authme/settings/NewSettingIntegrationTest.java +++ b/src/test/java/fr/xephi/authme/settings/SettingsIntegrationTest.java @@ -27,9 +27,9 @@ import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertThat; /** - * Integration test for {@link NewSetting}. + * Integration test for {@link Settings}. */ -public class NewSettingIntegrationTest { +public class SettingsIntegrationTest { /** File name of the sample config including all {@link TestConfiguration} values. */ private static final String COMPLETE_FILE = TestHelper.PROJECT_ROOT + "settings/config-sample-values.yml"; @@ -63,7 +63,7 @@ public class NewSettingIntegrationTest { File newFile = temporaryFolder.newFile(); // when / then - NewSetting settings = new NewSetting(configuration, newFile, testPluginFolder, propertyMap, + Settings settings = new Settings(configuration, newFile, testPluginFolder, propertyMap, checkAllPropertiesPresent()); Map, Object> expectedValues = ImmutableMap., Object>builder() .put(TestConfiguration.DURATION_IN_SECONDS, 22) @@ -90,13 +90,13 @@ public class NewSettingIntegrationTest { File file = copyFileFromResources(INCOMPLETE_FILE); YamlConfiguration configuration = YamlConfiguration.loadConfiguration(file); // Expectation: File is rewritten to since it does not have all configurations - new NewSetting(configuration, file, testPluginFolder, propertyMap, checkAllPropertiesPresent()); + new Settings(configuration, file, testPluginFolder, propertyMap, checkAllPropertiesPresent()); // Load the settings again -> checks that what we wrote can be loaded again configuration = YamlConfiguration.loadConfiguration(file); // then - NewSetting settings = new NewSetting(configuration, file, testPluginFolder, propertyMap, + Settings settings = new Settings(configuration, file, testPluginFolder, propertyMap, checkAllPropertiesPresent()); Map, Object> expectedValues = ImmutableMap., Object>builder() .put(TestConfiguration.DURATION_IN_SECONDS, 22) @@ -133,14 +133,14 @@ public class NewSettingIntegrationTest { } // when - new NewSetting(configuration, file, testPluginFolder, propertyMap, checkAllPropertiesPresent()); + new Settings(configuration, file, testPluginFolder, propertyMap, checkAllPropertiesPresent()); // reload the file as settings should have been rewritten configuration = YamlConfiguration.loadConfiguration(file); // then // assert that we won't rewrite the settings again! One rewrite should produce a valid, complete configuration File unusedFile = new File("config-difficult-values.unused.yml"); - NewSetting settings = new NewSetting(configuration, unusedFile, testPluginFolder, propertyMap, + Settings settings = new Settings(configuration, unusedFile, testPluginFolder, propertyMap, checkAllPropertiesPresent()); assertThat(unusedFile.exists(), equalTo(false)); assertThat(configuration.contains(TestConfiguration.DUST_LEVEL.getPath()), equalTo(true)); @@ -171,7 +171,7 @@ public class NewSettingIntegrationTest { // given YamlConfiguration configuration = YamlConfiguration.loadConfiguration(temporaryFolder.newFile()); File fullConfigFile = copyFileFromResources(COMPLETE_FILE); - NewSetting settings = new NewSetting(configuration, fullConfigFile, testPluginFolder, propertyMap, + Settings settings = new Settings(configuration, fullConfigFile, testPluginFolder, propertyMap, TestSettingsMigrationServices.alwaysFulfilled()); // when diff --git a/src/test/java/fr/xephi/authme/settings/NewSettingTest.java b/src/test/java/fr/xephi/authme/settings/SettingsTest.java similarity index 92% rename from src/test/java/fr/xephi/authme/settings/NewSettingTest.java rename to src/test/java/fr/xephi/authme/settings/SettingsTest.java index e53a66d23..fffbf15e9 100644 --- a/src/test/java/fr/xephi/authme/settings/NewSettingTest.java +++ b/src/test/java/fr/xephi/authme/settings/SettingsTest.java @@ -38,9 +38,9 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; /** - * Unit tests for {@link NewSetting}. + * Unit tests for {@link Settings}. */ -public class NewSettingTest { +public class SettingsTest { @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); @@ -71,7 +71,7 @@ public class NewSettingTest { setReturnValue(configuration, TestConfiguration.SYSTEM_NAME, "myTestSys"); // when / then - NewSetting settings = new NewSetting(configuration, null, null, null, null); + Settings settings = new Settings(configuration, null, null, null, null); assertThat(settings.getProperty(TestConfiguration.VERSION_NUMBER), equalTo(20)); assertThat(settings.getProperty(TestConfiguration.SKIP_BORING_FEATURES), equalTo(true)); @@ -87,7 +87,7 @@ public class NewSettingTest { public void shouldReturnDefaultFile() throws IOException { // given YamlConfiguration configuration = mock(YamlConfiguration.class); - NewSetting settings = new NewSetting(configuration, null, null, null, null); + Settings settings = new Settings(configuration, null, null, null, null); // when String defaultFile = settings.getDefaultMessagesFile(); @@ -103,7 +103,7 @@ public class NewSettingTest { public void shouldSetProperty() { // given YamlConfiguration configuration = mock(YamlConfiguration.class); - NewSetting settings = new NewSetting(configuration, null, null, null, null); + Settings settings = new Settings(configuration, null, null, null, null); // when settings.setProperty(TestConfiguration.DUST_LEVEL, -4); @@ -123,7 +123,7 @@ public class NewSettingTest { YamlConfiguration configuration = mock(YamlConfiguration.class); given(configuration.contains(anyString())).willReturn(true); setReturnValue(configuration, MESSAGES_LANGUAGE, languageCode); - NewSetting settings = new NewSetting(configuration, null, testPluginFolder, + Settings settings = new Settings(configuration, null, testPluginFolder, TestConfiguration.generatePropertyMap(), TestSettingsMigrationServices.alwaysFulfilled()); // when @@ -140,7 +140,7 @@ public class NewSettingTest { YamlConfiguration configuration = mock(YamlConfiguration.class); given(configuration.contains(anyString())).willReturn(true); setReturnValue(configuration, MESSAGES_LANGUAGE, "doesntexist"); - NewSetting settings = new NewSetting(configuration, null, testPluginFolder, + Settings settings = new Settings(configuration, null, testPluginFolder, TestConfiguration.generatePropertyMap(), TestSettingsMigrationServices.alwaysFulfilled()); // when @@ -161,7 +161,7 @@ public class NewSettingTest { YamlConfiguration configuration = mock(YamlConfiguration.class); setReturnValue(configuration, RegistrationSettings.USE_WELCOME_MESSAGE, true); - NewSetting settings = new NewSetting(configuration, null, testPluginFolder, + Settings settings = new Settings(configuration, null, testPluginFolder, TestConfiguration.generatePropertyMap(), TestSettingsMigrationServices.alwaysFulfilled()); // when @@ -182,7 +182,7 @@ public class NewSettingTest { Files.write(emailFile.toPath(), emailMessage.getBytes()); YamlConfiguration configuration = mock(YamlConfiguration.class); - NewSetting settings = new NewSetting(configuration, null, testPluginFolder, + Settings settings = new Settings(configuration, null, testPluginFolder, TestConfiguration.generatePropertyMap(), TestSettingsMigrationServices.alwaysFulfilled()); // when @@ -207,7 +207,7 @@ public class NewSettingTest { } } - private static void assertDefaultValue(Property property, NewSetting setting) { + private static void assertDefaultValue(Property property, Settings setting) { assertThat(property.getPath() + " has default value", setting.getProperty(property).equals(property.getDefaultValue()), equalTo(true)); } diff --git a/src/test/java/fr/xephi/authme/settings/SpawnLoaderTest.java b/src/test/java/fr/xephi/authme/settings/SpawnLoaderTest.java index 86e75c546..8449b121f 100644 --- a/src/test/java/fr/xephi/authme/settings/SpawnLoaderTest.java +++ b/src/test/java/fr/xephi/authme/settings/SpawnLoaderTest.java @@ -36,7 +36,7 @@ public class SpawnLoaderTest { private SpawnLoader spawnLoader; @Mock - private NewSetting settings; + private Settings settings; @Mock private DataSource dataSource; diff --git a/src/test/java/fr/xephi/authme/task/PlayerDataTaskManagerTest.java b/src/test/java/fr/xephi/authme/task/PlayerDataTaskManagerTest.java index 19fccd653..ab4d6ef92 100644 --- a/src/test/java/fr/xephi/authme/task/PlayerDataTaskManagerTest.java +++ b/src/test/java/fr/xephi/authme/task/PlayerDataTaskManagerTest.java @@ -6,7 +6,7 @@ import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.PlayerData; import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.Messages; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.RegistrationSettings; import fr.xephi.authme.settings.properties.RestrictionSettings; import fr.xephi.authme.util.BukkitService; @@ -40,7 +40,7 @@ public class PlayerDataTaskManagerTest { private Messages messages; @Mock - private NewSetting settings; + private Settings settings; @Mock private BukkitService bukkitService; diff --git a/src/test/java/fr/xephi/authme/task/purge/PurgeServiceTest.java b/src/test/java/fr/xephi/authme/task/purge/PurgeServiceTest.java index 01f00b1f5..82da5f6ec 100644 --- a/src/test/java/fr/xephi/authme/task/purge/PurgeServiceTest.java +++ b/src/test/java/fr/xephi/authme/task/purge/PurgeServiceTest.java @@ -4,7 +4,7 @@ import fr.xephi.authme.ReflectionTestUtils; import fr.xephi.authme.TestHelper; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.permission.PermissionsManager; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.PurgeSettings; import fr.xephi.authme.util.BukkitService; import org.bukkit.OfflinePlayer; @@ -57,7 +57,7 @@ public class PurgeServiceTest { @Mock private DataSource dataSource; @Mock - private NewSetting settings; + private Settings settings; @Mock private PermissionsManager permissionsManager; @Mock diff --git a/src/test/java/fr/xephi/authme/util/MigrationServiceTest.java b/src/test/java/fr/xephi/authme/util/MigrationServiceTest.java index 34fda2bb8..5a3f19ee0 100644 --- a/src/test/java/fr/xephi/authme/util/MigrationServiceTest.java +++ b/src/test/java/fr/xephi/authme/util/MigrationServiceTest.java @@ -6,7 +6,7 @@ import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.security.crypts.HashedPassword; import fr.xephi.authme.security.crypts.SHA256; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.SecuritySettings; import org.junit.BeforeClass; import org.junit.Test; @@ -36,7 +36,7 @@ import static org.mockito.Mockito.verifyNoMoreInteractions; public class MigrationServiceTest { @Mock - private NewSetting settings; + private Settings settings; @Mock private DataSource dataSource; diff --git a/src/test/java/fr/xephi/authme/util/TeleportationServiceTest.java b/src/test/java/fr/xephi/authme/util/TeleportationServiceTest.java index 82b57b5dc..381165545 100644 --- a/src/test/java/fr/xephi/authme/util/TeleportationServiceTest.java +++ b/src/test/java/fr/xephi/authme/util/TeleportationServiceTest.java @@ -5,7 +5,7 @@ import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.limbo.PlayerData; import fr.xephi.authme.events.FirstSpawnTeleportEvent; import fr.xephi.authme.events.SpawnTeleportEvent; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.SpawnLoader; import fr.xephi.authme.settings.properties.RestrictionSettings; import org.bukkit.Location; @@ -46,7 +46,7 @@ public class TeleportationServiceTest { private TeleportationService teleportationService; @Mock - private NewSetting settings; + private Settings settings; @Mock private BukkitService bukkitService; diff --git a/src/test/java/fr/xephi/authme/util/ValidationServiceTest.java b/src/test/java/fr/xephi/authme/util/ValidationServiceTest.java index 3c9fd5d25..d90275212 100644 --- a/src/test/java/fr/xephi/authme/util/ValidationServiceTest.java +++ b/src/test/java/fr/xephi/authme/util/ValidationServiceTest.java @@ -8,7 +8,7 @@ import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.permission.PermissionsManager; import fr.xephi.authme.permission.PlayerStatePermission; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.EmailSettings; import fr.xephi.authme.settings.properties.RestrictionSettings; import fr.xephi.authme.settings.properties.SecuritySettings; @@ -35,7 +35,7 @@ public class ValidationServiceTest { @InjectDelayed private ValidationService validationService; @Mock - private NewSetting settings; + private Settings settings; @Mock private DataSource dataSource; @Mock diff --git a/src/test/java/tools/hashmethods/EncryptionMethodInfoGatherer.java b/src/test/java/tools/hashmethods/EncryptionMethodInfoGatherer.java index 51d7c38d8..7e8c18f77 100644 --- a/src/test/java/tools/hashmethods/EncryptionMethodInfoGatherer.java +++ b/src/test/java/tools/hashmethods/EncryptionMethodInfoGatherer.java @@ -8,7 +8,7 @@ import fr.xephi.authme.security.crypts.HexSaltedMethod; import fr.xephi.authme.security.crypts.description.AsciiRestricted; import fr.xephi.authme.security.crypts.description.HasSalt; import fr.xephi.authme.security.crypts.description.Recommendation; -import fr.xephi.authme.settings.NewSetting; +import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.domain.Property; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; @@ -140,7 +140,7 @@ public class EncryptionMethodInfoGatherer { @SuppressWarnings("unchecked") private static Injector createInitializer() { - NewSetting settings = mock(NewSetting.class); + Settings settings = mock(Settings.class); // Return the default value for any property when(settings.getProperty(any(Property.class))).thenAnswer(new Answer() { @Override @@ -153,7 +153,7 @@ public class EncryptionMethodInfoGatherer { // By passing some bogus "package" to the constructor, the injector will throw if it needs to // instantiate any dependency other than what we provide. Injector injector = new InjectorBuilder().addDefaultHandlers("!!No package!!").create(); - injector.register(NewSetting.class, settings); + injector.register(Settings.class, settings); return injector; }