Add headless option

This commit is contained in:
austin 2022-04-28 22:42:01 -04:00
parent 8ec6388477
commit ebb2cb8769
4 changed files with 32 additions and 51 deletions

15
.vscode/launch.json vendored
View File

@ -10,19 +10,20 @@
"request": "launch",
"mainClass": "${file}"
},
{
"type": "java",
"name": "Launch TerrainGen",
"request": "launch",
"mainClass": "electrosphere.game.server.terrain.generation.TerrainGen",
"projectName": "Renderer"
},
{
"type": "java",
"name": "Launch Main",
"request": "launch",
"mainClass": "electrosphere.main.Main",
"projectName": "Renderer"
},
{
"type": "java",
"name": "Launch Main (Headless)",
"request": "launch",
"mainClass": "electrosphere.main.Main",
"projectName": "Renderer",
"args" : "--headless"
}
]
}

44
.vscode/tasks.json vendored
View File

@ -1,44 +0,0 @@
{
"tasks": [
{
"label": "Build",
"type": "shell",
"command": "mvn process-classes",
"windows": {
"command": "mvn process-classes"
},
"group": "build",
"presentation": {
"reveal": "silent",
"panel": "shared",
}
},
{
"label": "Clean and Build",
"type": "shell",
"command": "mvn clean package",
"windows": {
"command": "mvn clean package"
},
"group": "build",
"presentation": {
"reveal": "silent",
"panel": "shared",
}
},
{
"label": "Run",
"type": "shell",
"command": "mvn process-classes exec:exec",
"windows": {
"command": "mvn process-classes exec:exec"
},
"group": "test",
"presentation": {
"reveal": "silent",
"panel": "shared",
}
},
]
}

View File

@ -0,0 +1,20 @@
package electrosphere.engine.cli;
import java.util.Arrays;
import java.util.List;
import electrosphere.main.Globals;
public class CLIParser {
public static void parseCLIArgs(String args[]){
List<String> argList = Arrays.asList(args);
for(String arg : argList){
if(arg.equals("--headless")){
Globals.RUN_CLIENT = false;
Globals.RUN_SERVER = true;
}
}
}
}

View File

@ -17,6 +17,7 @@ import electrosphere.entity.types.item.ItemUtils;
import electrosphere.entity.types.attach.AttachUtils;
import electrosphere.entity.types.camera.CameraEntityUtils;
import electrosphere.engine.LoadingThread;
import electrosphere.engine.cli.CLIParser;
import electrosphere.game.client.ClientFunctions;
import electrosphere.game.client.targeting.crosshair.Crosshair;
import electrosphere.game.config.UserSettings;
@ -118,6 +119,9 @@ public class Main {
//
//
//parse command line arguments
CLIParser.parseCLIArgs(args);
//initialize logging interfaces
LoggerInterface.initLoggers();