[FEATURE] checkInstallCommand и MultiCommand

This commit is contained in:
Gravit 2019-02-04 14:20:28 +07:00
parent 7f9ca582d6
commit 64cf9788d9
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
4 changed files with 63 additions and 1 deletions

View file

@ -220,7 +220,11 @@ public static void main(String... args) throws Throwable {
// Start LaunchServer // Start LaunchServer
Instant start = Instant.now(); Instant start = Instant.now();
try { 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) { } catch (Throwable exc) {
LogHelper.error(exc); LogHelper.error(exc);
return; return;

View file

@ -8,6 +8,8 @@
import ru.gravit.launchserver.command.dump.DumpEntryCacheCommand; import ru.gravit.launchserver.command.dump.DumpEntryCacheCommand;
import ru.gravit.launchserver.command.dump.DumpSessionsCommand; import ru.gravit.launchserver.command.dump.DumpSessionsCommand;
import ru.gravit.launchserver.command.hash.*; 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.LoadModuleCommand;
import ru.gravit.launchserver.command.modules.ModulesCommand; import ru.gravit.launchserver.command.modules.ModulesCommand;
import ru.gravit.launchserver.command.service.*; import ru.gravit.launchserver.command.service.*;
@ -120,6 +122,8 @@ protected CommandHandler(LaunchServer server) {
registerCommand("configList", new ConfigListCommand(server)); registerCommand("configList", new ConfigListCommand(server));
registerCommand("swapAuthProvider", new SwapAuthProviderCommand(server)); registerCommand("swapAuthProvider", new SwapAuthProviderCommand(server));
registerCommand("serverStatus", new ServerStatusCommand(server)); registerCommand("serverStatus", new ServerStatusCommand(server));
registerCommand("checkInstall", new CheckInstallCommand(server));
registerCommand("multi", new MultiCommand(server));
} }

View file

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

View file

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