diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/command/dao/GetAllUsersCommand.java b/LaunchServer/src/main/java/pro/gravit/launchserver/command/dao/GetAllUsersCommand.java new file mode 100644 index 00000000..e5aa13fa --- /dev/null +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/command/dao/GetAllUsersCommand.java @@ -0,0 +1,33 @@ +package pro.gravit.launchserver.command.dao; + +import pro.gravit.launchserver.LaunchServer; +import pro.gravit.launchserver.command.Command; +import pro.gravit.launchserver.dao.User; +import pro.gravit.utils.helper.LogHelper; + +public class GetAllUsersCommand extends Command { + public GetAllUsersCommand(LaunchServer server) { + super(server); + } + + @Override + public String getArgsDescription() { + return ""; + } + + @Override + public String getUsageDescription() { + return "get all users information"; + } + + @Override + public void invoke(String... args) throws Exception { + int count = 0; + for(User user : server.userService.findAllUsers()) + { + LogHelper.subInfo("[%s] UUID: %s", user.username, user.uuid.toString()); + count++; + } + LogHelper.info("Print %d users", count); + } +} diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/command/handler/CommandHandler.java b/LaunchServer/src/main/java/pro/gravit/launchserver/command/handler/CommandHandler.java index a348db88..bf1f76bf 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/command/handler/CommandHandler.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/command/handler/CommandHandler.java @@ -2,6 +2,7 @@ import pro.gravit.launchserver.command.auth.*; import pro.gravit.launchserver.command.basic.*; +import pro.gravit.launchserver.command.dao.GetAllUsersCommand; import pro.gravit.launchserver.command.dao.GetUserCommand; import pro.gravit.launchserver.command.dao.RegisterCommand; import pro.gravit.launchserver.command.hash.*; @@ -63,6 +64,7 @@ public static void registerCommands(pro.gravit.utils.command.CommandHandler hand BaseCommandCategory dao = new BaseCommandCategory(); dao.registerCommand("register", new RegisterCommand(server)); dao.registerCommand("getUser", new GetUserCommand(server)); + dao.registerCommand("getAllUsers", new GetAllUsersCommand(server)); Category daoCategory = new Category(dao, "DAO", "Data Management"); handler.registerCategory(daoCategory);