Skip to content

Commit

Permalink
[FEATURE] Support command execute by args
Browse files Browse the repository at this point in the history
  • Loading branch information
gravit0 committed Jul 5, 2024
1 parent 78be606 commit 353b663
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
1 change: 0 additions & 1 deletion LaunchServer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ tasks.register('cleanjar', Jar) {
dependsOn jar
archiveClassifier.set('clean')
manifest.attributes("Main-Class": mainClassName,
"Premain-Class": mainAgentName,
"Automatic-Module-Name": "launchserver"
)
from sourceSets.main.output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -135,7 +136,24 @@ public static void main(String[] args) throws Exception {
.setLaunchServerConfigManager(launchServerConfigManager)
.setCertificateManager(certificateManager)
.build();
if (!prepareMode) {
List<String> 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();
Expand Down

0 comments on commit 353b663

Please sign in to comment.