[FEATURE] Команда GetAllUsers выводящая информацию о всех пользователях

This commit is contained in:
Gravit 2019-06-03 14:14:36 +07:00
parent 213e19763a
commit 952279b1f4
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
2 changed files with 35 additions and 0 deletions

View file

@ -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);
}
}

View file

@ -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);