mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
[FEATURE] Команда GetAllUsers выводящая информацию о всех пользователях
This commit is contained in:
parent
213e19763a
commit
952279b1f4
2 changed files with 35 additions and 0 deletions
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import pro.gravit.launchserver.command.auth.*;
|
import pro.gravit.launchserver.command.auth.*;
|
||||||
import pro.gravit.launchserver.command.basic.*;
|
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.GetUserCommand;
|
||||||
import pro.gravit.launchserver.command.dao.RegisterCommand;
|
import pro.gravit.launchserver.command.dao.RegisterCommand;
|
||||||
import pro.gravit.launchserver.command.hash.*;
|
import pro.gravit.launchserver.command.hash.*;
|
||||||
|
@ -63,6 +64,7 @@ public static void registerCommands(pro.gravit.utils.command.CommandHandler hand
|
||||||
BaseCommandCategory dao = new BaseCommandCategory();
|
BaseCommandCategory dao = new BaseCommandCategory();
|
||||||
dao.registerCommand("register", new RegisterCommand(server));
|
dao.registerCommand("register", new RegisterCommand(server));
|
||||||
dao.registerCommand("getUser", new GetUserCommand(server));
|
dao.registerCommand("getUser", new GetUserCommand(server));
|
||||||
|
dao.registerCommand("getAllUsers", new GetAllUsersCommand(server));
|
||||||
Category daoCategory = new Category(dao, "DAO", "Data Management");
|
Category daoCategory = new Category(dao, "DAO", "Data Management");
|
||||||
handler.registerCategory(daoCategory);
|
handler.registerCategory(daoCategory);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue