From a0abe3d19d6f924e08b52ba4fa475a458623c864 Mon Sep 17 00:00:00 2001 From: ljacqu Date: Sun, 19 Jun 2016 16:13:00 +0200 Subject: [PATCH] Minor householding - Remove getter for NewSetting - Reduce visibility of classes used by DelayedRunner --- src/main/java/fr/xephi/authme/AuthMe.java | 8 -------- .../java/fr/xephi/authme/hooks/BungeeCordMessage.java | 10 +++++++--- .../java/fr/xephi/authme/runner/PendingInjection.java | 2 +- .../fr/xephi/authme/runner/RunBeforeInjectings.java | 2 +- .../java/fr/xephi/authme/runner/RunDelayedInjects.java | 2 +- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index a5f329cfe..75606f3e3 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -709,14 +709,6 @@ public class AuthMe extends JavaPlugin { // Service getters (deprecated) // Use @Inject fields instead // ------------- - /** - * @return NewSetting - * @deprecated should be used in API classes only (temporarily) - */ - @Deprecated - public NewSetting getSettings() { - return newSettings; - } /** * @return permission manager diff --git a/src/main/java/fr/xephi/authme/hooks/BungeeCordMessage.java b/src/main/java/fr/xephi/authme/hooks/BungeeCordMessage.java index 47e7d17da..5c145bbfb 100644 --- a/src/main/java/fr/xephi/authme/hooks/BungeeCordMessage.java +++ b/src/main/java/fr/xephi/authme/hooks/BungeeCordMessage.java @@ -9,6 +9,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.properties.SecuritySettings; import fr.xephi.authme.util.BukkitService; import org.bukkit.entity.Player; @@ -30,6 +31,9 @@ public class BungeeCordMessage implements PluginMessageListener { @Inject private AuthMe plugin; + + @Inject + private NewSetting settings; BungeeCordMessage() { } @@ -63,17 +67,17 @@ public class BungeeCordMessage implements PluginMessageListener { } //END - if (!plugin.getSettings().getProperty(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE)) { + if (!settings.getProperty(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE)) { ConsoleLogger.info("Player " + auth.getNickname() + " has logged in from one of your server!"); } } else if ("logout".equals(act)) { playerCache.removePlayer(name); dataSource.setUnlogged(name); - if (!plugin.getSettings().getProperty(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE)) { + if (!settings.getProperty(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE)) { ConsoleLogger.info("Player " + auth.getNickname() + " has logged out from one of your server!"); } } else if ("register".equals(act)) { - if (!plugin.getSettings().getProperty(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE)) { + if (!settings.getProperty(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE)) { ConsoleLogger.info("Player " + auth.getNickname() + " has registered out from one of your server!"); } } else if ("changepassword".equals(act)) { diff --git a/src/test/java/fr/xephi/authme/runner/PendingInjection.java b/src/test/java/fr/xephi/authme/runner/PendingInjection.java index 4eded71d0..f326d3ccf 100644 --- a/src/test/java/fr/xephi/authme/runner/PendingInjection.java +++ b/src/test/java/fr/xephi/authme/runner/PendingInjection.java @@ -10,7 +10,7 @@ import java.lang.reflect.Method; /** * Contains all necessary information to initialize a {@link InjectDelayed} field. */ -public class PendingInjection { +class PendingInjection { private Field field; private Object[] dependencies; diff --git a/src/test/java/fr/xephi/authme/runner/RunBeforeInjectings.java b/src/test/java/fr/xephi/authme/runner/RunBeforeInjectings.java index 46085ceab..7a6ba70b8 100644 --- a/src/test/java/fr/xephi/authme/runner/RunBeforeInjectings.java +++ b/src/test/java/fr/xephi/authme/runner/RunBeforeInjectings.java @@ -11,7 +11,7 @@ import java.util.List; * after Mockito's @Mock, @Spy and @InjectMocks have taken effect, * but before {@link InjectDelayed} fields are handled. */ -public class RunBeforeInjectings extends Statement { +class RunBeforeInjectings extends Statement { private final Statement next; private final List beforeInjectings; diff --git a/src/test/java/fr/xephi/authme/runner/RunDelayedInjects.java b/src/test/java/fr/xephi/authme/runner/RunDelayedInjects.java index 0fcf83045..ec0026dfb 100644 --- a/src/test/java/fr/xephi/authme/runner/RunDelayedInjects.java +++ b/src/test/java/fr/xephi/authme/runner/RunDelayedInjects.java @@ -9,7 +9,7 @@ import java.util.List; * Statement for initializing {@link InjectDelayed} fields. These fields are * constructed after {@link BeforeInjecting} and before JUnit's @Before. */ -public class RunDelayedInjects extends Statement { +class RunDelayedInjects extends Statement { private final Statement next; private final Object target;