From 1d4d9ae170fe1493716791c5e7add8685c8cd624 Mon Sep 17 00:00:00 2001 From: Gravit Date: Sat, 6 Apr 2019 17:51:53 +0700 Subject: [PATCH] [FIX] GetHWIDCommand --- .../command/auth/GetHWIDCommand.java | 40 +++++++++++++++++++ .../command/handler/CommandHandler.java | 1 + .../command/service/ReloadAllCommand.java | 1 - 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 LaunchServer/src/main/java/ru/gravit/launchserver/command/auth/GetHWIDCommand.java diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/auth/GetHWIDCommand.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/auth/GetHWIDCommand.java new file mode 100644 index 00000000..f8d1711e --- /dev/null +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/auth/GetHWIDCommand.java @@ -0,0 +1,40 @@ +package ru.gravit.launchserver.command.auth; + +import ru.gravit.launcher.HWID; +import ru.gravit.launchserver.LaunchServer; +import ru.gravit.launchserver.command.Command; +import ru.gravit.utils.helper.LogHelper; + +import java.util.List; + +public class GetHWIDCommand extends Command { + public GetHWIDCommand(LaunchServer server) { + super(server); + } + + @Override + public String getArgsDescription() { + return "[username]"; + } + + @Override + public String getUsageDescription() { + return "get HWID from username"; + } + + @Override + public void invoke(String... args) throws Exception { + verifyArgs(args, 1); + List target = server.config.hwidHandler.getHwid(args[0]); + for(HWID hwid : target) + { + if(hwid == null) + { + LogHelper.error("HWID %s: null", args[0]); + continue; + } + LogHelper.info("HWID %s: %s", args[0], hwid.toString()); + } + LogHelper.info("Found %d HWID", target.size()); + } +} diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/handler/CommandHandler.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/handler/CommandHandler.java index 6bd6a752..e07282b7 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/command/handler/CommandHandler.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/handler/CommandHandler.java @@ -48,6 +48,7 @@ public static void registerCommands(ru.gravit.utils.command.CommandHandler handl handler.registerCommand("uuidToUsername", new UUIDToUsernameCommand(server)); handler.registerCommand("ban", new BanCommand(server)); handler.registerCommand("unban", new UnbanCommand(server)); + handler.registerCommand("getHWID", new GetHWIDCommand(server)); //Register dump commands handler.registerCommand("dumpSessions", new DumpSessionsCommand(server)); diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/service/ReloadAllCommand.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/service/ReloadAllCommand.java index cd3ad504..54f39566 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/command/service/ReloadAllCommand.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/service/ReloadAllCommand.java @@ -21,7 +21,6 @@ public String getUsageDescription() { @Override public void invoke(String... args) throws Exception { - verifyArgs(args, 1); LogHelper.info("Reload all config"); server.reloadManager.reloadAll(); }