From 952279b1f48e2eed2caecab8e7d3ea591290f42a Mon Sep 17 00:00:00 2001 From: Gravit Date: Mon, 3 Jun 2019 14:14:36 +0700 Subject: [PATCH] =?UTF-8?q?[FEATURE]=20=D0=9A=D0=BE=D0=BC=D0=B0=D0=BD?= =?UTF-8?q?=D0=B4=D0=B0=20GetAllUsers=20=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4?= =?UTF-8?q?=D1=8F=D1=89=D0=B0=D1=8F=20=D0=B8=D0=BD=D1=84=D0=BE=D1=80=D0=BC?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8E=20=D0=BE=20=D0=B2=D1=81=D0=B5=D1=85=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5?= =?UTF-8?q?=D0=BB=D1=8F=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../command/dao/GetAllUsersCommand.java | 33 +++++++++++++++++++ .../command/handler/CommandHandler.java | 2 ++ 2 files changed, 35 insertions(+) create mode 100644 LaunchServer/src/main/java/pro/gravit/launchserver/command/dao/GetAllUsersCommand.java 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);