diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 6a0e80dd..1c9dbdcf 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -118,7 +118,7 @@ public class AuthMe extends JavaPlugin { /** * Method used to obtain the v2 plugin's api instance - * @deprecated Will be removed in 5.4! + * @deprecated Will be removed in 5.4, use {@link fr.xephi.authme.api.v3.AuthMeApi} instead * * @return The plugin's api instance */ @@ -264,7 +264,7 @@ public class AuthMe extends JavaPlugin { commandHandler = injector.getSingleton(CommandHandler.class); // Trigger construction of API classes; they will keep track of the singleton - injector.getSingleton(fr.xephi.authme.api.v3.AuthMeAPI.class); + injector.getSingleton(fr.xephi.authme.api.v3.AuthMeApi.class); injector.getSingleton(NewAPI.class); } diff --git a/src/main/java/fr/xephi/authme/api/NewAPI.java b/src/main/java/fr/xephi/authme/api/NewAPI.java index 1df6ffda..f3f22bb5 100644 --- a/src/main/java/fr/xephi/authme/api/NewAPI.java +++ b/src/main/java/fr/xephi/authme/api/NewAPI.java @@ -21,12 +21,13 @@ import java.util.List; /** * The v2 API of AuthMe. - * @deprecated Will be removed in 5.4! * * Recommended method of retrieving the API object: * * NewAPI authmeApi = NewAPI.getInstance(); * + * + * @deprecated Will be removed in 5.4! Use {@link fr.xephi.authme.api.v3.AuthMeApi} instead. */ @SuppressWarnings({"checkstyle:AbbreviationAsWordInName"}) // Justification: Class name cannot be changed anymore @Deprecated diff --git a/src/main/java/fr/xephi/authme/api/v3/AuthMeAPI.java b/src/main/java/fr/xephi/authme/api/v3/AuthMeApi.java similarity index 90% rename from src/main/java/fr/xephi/authme/api/v3/AuthMeAPI.java rename to src/main/java/fr/xephi/authme/api/v3/AuthMeApi.java index ac5d2d9e..e858c1f7 100644 --- a/src/main/java/fr/xephi/authme/api/v3/AuthMeAPI.java +++ b/src/main/java/fr/xephi/authme/api/v3/AuthMeApi.java @@ -20,17 +20,16 @@ import java.util.ArrayList; import java.util.List; /** - * The current AuthMeAPI of AuthMe. + * The current AuthMeApi of AuthMe. * - * Recommended method of retrieving the AuthMeAPI object: + * Recommended method of retrieving the AuthMeApi object: * - * AuthMeAPI authmeApi = AuthMeAPI.getInstance(); + * AuthMeApi authmeApi = AuthMeApi.getInstance(); * */ -@SuppressWarnings({"checkstyle:AbbreviationAsWordInName"}) // Justification: Class name cannot be changed anymore -public class AuthMeAPI { +public class AuthMeApi { - private static AuthMeAPI singleton; + private static AuthMeApi singleton; private final AuthMe plugin; private final PluginHookService pluginHookService; private final DataSource dataSource; @@ -40,10 +39,10 @@ public class AuthMeAPI { private final PlayerCache playerCache; /* - * Constructor for NewAPI. + * Constructor for AuthMeApi. */ @Inject - AuthMeAPI(AuthMe plugin, PluginHookService pluginHookService, DataSource dataSource, PasswordSecurity passwordSecurity, + AuthMeApi(AuthMe plugin, PluginHookService pluginHookService, DataSource dataSource, PasswordSecurity passwordSecurity, Management management, ValidationService validationService, PlayerCache playerCache) { this.plugin = plugin; this.pluginHookService = pluginHookService; @@ -52,19 +51,19 @@ public class AuthMeAPI { this.management = management; this.validationService = validationService; this.playerCache = playerCache; - AuthMeAPI.singleton = this; + AuthMeApi.singleton = this; } /** - * Get the AuthMeAPI object for AuthMe. + * Get the AuthMeApi object for AuthMe. * - * @return The AuthMeAPI object, or null if the AuthMe plugin is not enabled or not fully initialized yet + * @return The AuthMeApi object, or null if the AuthMe plugin is not enabled or not fully initialized yet */ - public static AuthMeAPI getInstance() { + public static AuthMeApi getInstance() { if (singleton != null) { return singleton; } - // NewAPI is initialized in AuthMe#onEnable -> if singleton is null, + // AuthMeApi is initialized in AuthMe#onEnable -> if singleton is null, // it means AuthMe isn't initialized (yet) return null; } @@ -80,7 +79,7 @@ public class AuthMeAPI { /** * Gather the version number of the plugin. - * This can be used to determine whether certain AuthMeAPI features are available or not. + * This can be used to determine whether certain AuthMeApi features are available or not. * * @return Plugin version identifier as a string. */ @@ -104,7 +103,7 @@ public class AuthMeAPI { * @param player The player to verify * @return true if the player is an npc */ - public boolean isNPC(Player player) { + public boolean isNpc(Player player) { return pluginHookService.isNpc(player); } diff --git a/src/test/java/fr/xephi/authme/api/v3/AuthMeAPITest.java b/src/test/java/fr/xephi/authme/api/v3/AuthMeApiTest.java similarity index 95% rename from src/test/java/fr/xephi/authme/api/v3/AuthMeAPITest.java rename to src/test/java/fr/xephi/authme/api/v3/AuthMeApiTest.java index d34c3d0d..3a8968ba 100644 --- a/src/test/java/fr/xephi/authme/api/v3/AuthMeAPITest.java +++ b/src/test/java/fr/xephi/authme/api/v3/AuthMeApiTest.java @@ -2,7 +2,6 @@ package fr.xephi.authme.api.v3; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ReflectionTestUtils; -import fr.xephi.authme.api.v3.AuthMeAPI; import fr.xephi.authme.data.auth.PlayerAuth; import fr.xephi.authme.data.auth.PlayerCache; import fr.xephi.authme.datasource.DataSource; @@ -36,13 +35,13 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; /** - * Test for {@link fr.xephi.authme.api.v3.AuthMeAPI}. + * Test for {@link AuthMeApi}. */ @RunWith(MockitoJUnitRunner.class) -public class AuthMeAPITest { +public class AuthMeApiTest { @InjectMocks - private AuthMeAPI api; + private AuthMeApi api; @Mock private AuthMe authMe; @@ -61,11 +60,11 @@ public class AuthMeAPITest { @Test public void shouldReturnInstanceOrNull() { - AuthMeAPI result = AuthMeAPI.getInstance(); + AuthMeApi result = AuthMeApi.getInstance(); assertThat(result, sameInstance(api)); - ReflectionTestUtils.setField(AuthMeAPI.class, null, "singleton", null); - assertThat(AuthMeAPI.getInstance(), nullValue()); + ReflectionTestUtils.setField(AuthMeApi.class, null, "singleton", null); + assertThat(AuthMeApi.getInstance(), nullValue()); } @Test @@ -90,7 +89,7 @@ public class AuthMeAPITest { given(pluginHookService.isNpc(player)).willReturn(true); // when - boolean result = api.isNPC(player); + boolean result = api.isNpc(player); // then assertThat(result, equalTo(true));