From 64cf9788d925be5e38336e7643c8cfa420fb8a96 Mon Sep 17 00:00:00 2001 From: Gravit Date: Mon, 4 Feb 2019 14:20:28 +0700 Subject: [PATCH] =?UTF-8?q?[FEATURE]=20checkInstallCommand=20=D0=B8=20Mult?= =?UTF-8?q?iCommand?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ru/gravit/launchserver/LaunchServer.java | 6 +++- .../command/handler/CommandHandler.java | 4 +++ .../command/install/CheckInstallCommand.java | 26 +++++++++++++++++ .../command/install/MultiCommand.java | 28 +++++++++++++++++++ 4 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 LaunchServer/src/main/java/ru/gravit/launchserver/command/install/CheckInstallCommand.java create mode 100644 LaunchServer/src/main/java/ru/gravit/launchserver/command/install/MultiCommand.java diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java index 677bf31a..b16afa2b 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java @@ -220,7 +220,11 @@ public static void main(String... args) throws Throwable { // Start LaunchServer Instant start = Instant.now(); try { - new LaunchServer(IOHelper.WORKING_DIR, args).run(); + LaunchServer launchserver = new LaunchServer(IOHelper.WORKING_DIR, args); + if(args.length == 0) launchserver.run(); + else { //Обработка команды + launchserver.commandHandler.eval(args,false); + } } catch (Throwable exc) { LogHelper.error(exc); return; 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 1e610f6a..c3d18b6c 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 @@ -8,6 +8,8 @@ import ru.gravit.launchserver.command.dump.DumpEntryCacheCommand; import ru.gravit.launchserver.command.dump.DumpSessionsCommand; import ru.gravit.launchserver.command.hash.*; +import ru.gravit.launchserver.command.install.CheckInstallCommand; +import ru.gravit.launchserver.command.install.MultiCommand; import ru.gravit.launchserver.command.modules.LoadModuleCommand; import ru.gravit.launchserver.command.modules.ModulesCommand; import ru.gravit.launchserver.command.service.*; @@ -120,6 +122,8 @@ protected CommandHandler(LaunchServer server) { registerCommand("configList", new ConfigListCommand(server)); registerCommand("swapAuthProvider", new SwapAuthProviderCommand(server)); registerCommand("serverStatus", new ServerStatusCommand(server)); + registerCommand("checkInstall", new CheckInstallCommand(server)); + registerCommand("multi", new MultiCommand(server)); } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/install/CheckInstallCommand.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/install/CheckInstallCommand.java new file mode 100644 index 00000000..0c9c2ae2 --- /dev/null +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/install/CheckInstallCommand.java @@ -0,0 +1,26 @@ +package ru.gravit.launchserver.command.install; + +import ru.gravit.launchserver.LaunchServer; +import ru.gravit.launchserver.command.Command; +import ru.gravit.utils.helper.LogHelper; + +public class CheckInstallCommand extends Command { + public CheckInstallCommand(LaunchServer server) { + super(server); + } + + @Override + public String getArgsDescription() { + return null; + } + + @Override + public String getUsageDescription() { + return null; + } + + @Override + public void invoke(String... args) throws Exception { + LogHelper.info("Check install success"); + } +} diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/install/MultiCommand.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/install/MultiCommand.java new file mode 100644 index 00000000..6033e9ae --- /dev/null +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/install/MultiCommand.java @@ -0,0 +1,28 @@ +package ru.gravit.launchserver.command.install; + +import ru.gravit.launchserver.LaunchServer; +import ru.gravit.launchserver.command.Command; + +public class MultiCommand extends Command { + public MultiCommand(LaunchServer server) { + super(server); + } + + @Override + public String getArgsDescription() { + return null; + } + + @Override + public String getUsageDescription() { + return null; + } + + @Override + public void invoke(String... args) throws Exception { + for(String arg : args) + { + server.commandHandler.eval(arg, false); + } + } +}