diff --git a/LaunchServer/build.gradle b/LaunchServer/build.gradle index bfed90ec..c12ca9a3 100644 --- a/LaunchServer/build.gradle +++ b/LaunchServer/build.gradle @@ -61,7 +61,6 @@ dependsOn jar archiveClassifier.set('clean') manifest.attributes("Main-Class": mainClassName, - "Premain-Class": mainAgentName, "Automatic-Module-Name": "launchserver" ) from sourceSets.main.output diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServerStarter.java b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServerStarter.java index addab8f3..0ddb43b3 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServerStarter.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServerStarter.java @@ -34,6 +34,7 @@ import java.nio.file.Path; import java.security.Security; import java.security.cert.CertificateException; +import java.util.ArrayList; import java.util.List; public class LaunchServerStarter { @@ -135,7 +136,24 @@ public static void main(String[] args) throws Exception { .setLaunchServerConfigManager(launchServerConfigManager) .setCertificateManager(certificateManager) .build(); - if (!prepareMode) { + List allArgs = List.of(args); + boolean isPrepareMode = prepareMode || allArgs.contains("--prepare"); + boolean isRunCommand = false; + String runCommand = null; + for(var e : allArgs) { + if(e.equals("--run")) { + isRunCommand = true; + continue; + } + if(isRunCommand) { + runCommand = e; + isRunCommand = false; + } + } + if(runCommand != null) { + localCommandHandler.eval(runCommand, false); + } + if (!isPrepareMode) { server.run(); } else { server.close();