diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 42b3bc33d..a19aab970 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -119,6 +119,15 @@ public class AuthMe extends JavaPlugin { return pluginBuildNumber; } + /** + * Method used to obtain the plugin's api instance + * + * @return The plugin's api instance + */ + public static NewAPI getApi() { + return NewAPI.getInstance(); + } + /** * Method called when the server enables the plugin. */ diff --git a/src/main/java/fr/xephi/authme/api/NewAPI.java b/src/main/java/fr/xephi/authme/api/NewAPI.java index 6b87cb53e..c77affa9a 100644 --- a/src/main/java/fr/xephi/authme/api/NewAPI.java +++ b/src/main/java/fr/xephi/authme/api/NewAPI.java @@ -14,11 +14,13 @@ import org.bukkit.Location; import org.bukkit.entity.Player; import javax.inject.Inject; +import java.util.ArrayList; +import java.util.List; /** * The current API of AuthMe. Recommended method of retrieving the API object: * - * NewAPI authmeApi = NewAPI.getInstance(); + * NewAPI authmeApi = AuthMe.getApi(); * */ public class NewAPI { @@ -218,4 +220,26 @@ public class NewAPI { public void forceUnregister(Player player) { management.performUnregisterByAdmin(null, player.getName(), player); } + + /** + * Get all the registered names (lowercase) + * + * @return registered names + */ + public List getRegisteredNames() { + List registeredNames = new ArrayList<>(); + dataSource.getAllAuths().forEach(auth -> registeredNames.add(auth.getNickname())); + return registeredNames; + } + + /** + * Get all the registered real-names (original case) + * + * @return registered real-names + */ + public List getRegisteredRealNames() { + List registeredNames = new ArrayList<>(); + dataSource.getAllAuths().forEach(auth -> registeredNames.add(auth.getRealName())); + return registeredNames; + } }