[FEATURE] Команда GetUser для просмотра информаици о пользователе

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

View file

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

View file

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