mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
[FEATURE] Команда GetUser для просмотра информаици о пользователе
This commit is contained in:
parent
e13c5580bc
commit
213e19763a
2 changed files with 43 additions and 0 deletions
|
@ -0,0 +1,34 @@
|
|||
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 GetUserCommand extends Command {
|
||||
public GetUserCommand(LaunchServer server) {
|
||||
super(server);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArgsDescription() {
|
||||
return "[username]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsageDescription() {
|
||||
return "get user information";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(String... args) throws Exception {
|
||||
verifyArgs(args, 1);
|
||||
User user = server.userService.findUserByUsername(args[0]);
|
||||
if(user == null)
|
||||
{
|
||||
LogHelper.error("User %s not found", args[1]);
|
||||
return;
|
||||
}
|
||||
LogHelper.info("[%s] UUID: %s", user.username, user.uuid.toString());
|
||||
}
|
||||
}
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
import pro.gravit.launchserver.command.auth.*;
|
||||
import pro.gravit.launchserver.command.basic.*;
|
||||
import pro.gravit.launchserver.command.dao.GetUserCommand;
|
||||
import pro.gravit.launchserver.command.dao.RegisterCommand;
|
||||
import pro.gravit.launchserver.command.hash.*;
|
||||
import pro.gravit.launchserver.command.install.CheckInstallCommand;
|
||||
import pro.gravit.launchserver.command.install.MultiCommand;
|
||||
|
@ -57,6 +59,13 @@ public static void registerCommands(pro.gravit.utils.command.CommandHandler hand
|
|||
Category updatesCategory = new Category(updates, "updates", "Update and Sync Management");
|
||||
handler.registerCategory(updatesCategory);
|
||||
|
||||
//Register dao commands
|
||||
BaseCommandCategory dao = new BaseCommandCategory();
|
||||
dao.registerCommand("register", new RegisterCommand(server));
|
||||
dao.registerCommand("getUser", new GetUserCommand(server));
|
||||
Category daoCategory = new Category(dao, "DAO", "Data Management");
|
||||
handler.registerCategory(daoCategory);
|
||||
|
||||
// Register auth commands
|
||||
BaseCommandCategory auth = new BaseCommandCategory();
|
||||
auth.registerCommand("auth", new AuthCommand(server));
|
||||
|
|
Loading…
Reference in a new issue