mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
[FEATURE] Support customJvmOptions
This commit is contained in:
parent
c351846a43
commit
afbed1345f
3 changed files with 8 additions and 3 deletions
|
@ -111,6 +111,7 @@ protected void initProps() {
|
||||||
properties.put("launcher.guardType", server.config.launcher.guardType);
|
properties.put("launcher.guardType", server.config.launcher.guardType);
|
||||||
properties.put("launchercore.env", server.config.env);
|
properties.put("launchercore.env", server.config.env);
|
||||||
properties.put("launcher.memory", server.config.launcher.memoryLimit);
|
properties.put("launcher.memory", server.config.launcher.memoryLimit);
|
||||||
|
properties.put("launcher.customJvmOptions", server.config.launcher.customJvmOptions);
|
||||||
if (server.config.launcher.encryptRuntime) {
|
if (server.config.launcher.encryptRuntime) {
|
||||||
if (server.runtime.runtimeEncryptKey == null)
|
if (server.runtime.runtimeEncryptKey == null)
|
||||||
server.runtime.runtimeEncryptKey = SecurityHelper.randomStringToken();
|
server.runtime.runtimeEncryptKey = SecurityHelper.randomStringToken();
|
||||||
|
|
|
@ -23,9 +23,7 @@
|
||||||
import pro.gravit.utils.helper.JVMHelper;
|
import pro.gravit.utils.helper.JVMHelper;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public final class LaunchServerConfig {
|
public final class LaunchServerConfig {
|
||||||
private transient final Logger logger = LogManager.getLogger();
|
private transient final Logger logger = LogManager.getLogger();
|
||||||
|
@ -292,6 +290,7 @@ public static class LauncherConf {
|
||||||
public boolean deleteTempFiles;
|
public boolean deleteTempFiles;
|
||||||
public boolean certificatePinning;
|
public boolean certificatePinning;
|
||||||
public boolean encryptRuntime;
|
public boolean encryptRuntime;
|
||||||
|
public List<String> customJvmOptions = new ArrayList<>();
|
||||||
public int memoryLimit = 256;
|
public int memoryLimit = 256;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@ public class ClientLauncherWrapper {
|
||||||
public static boolean waitProcess = Boolean.getBoolean(WAIT_PROCESS_PROPERTY);
|
public static boolean waitProcess = Boolean.getBoolean(WAIT_PROCESS_PROPERTY);
|
||||||
@LauncherInject("launcher.memory")
|
@LauncherInject("launcher.memory")
|
||||||
public static int launcherMemoryLimit;
|
public static int launcherMemoryLimit;
|
||||||
|
@LauncherInject("launcher.customJvmOptions")
|
||||||
|
public static List<String> customJvmOptions;
|
||||||
|
|
||||||
public static void main(String[] arguments) throws IOException, InterruptedException {
|
public static void main(String[] arguments) throws IOException, InterruptedException {
|
||||||
LogHelper.printVersion("Launcher");
|
LogHelper.printVersion("Launcher");
|
||||||
|
@ -138,6 +140,9 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep
|
||||||
if (context.memoryLimit != 0) {
|
if (context.memoryLimit != 0) {
|
||||||
args.add(String.format("-Xmx%dM", context.memoryLimit));
|
args.add(String.format("-Xmx%dM", context.memoryLimit));
|
||||||
}
|
}
|
||||||
|
if(customJvmOptions != null) {
|
||||||
|
args.addAll(customJvmOptions);
|
||||||
|
}
|
||||||
args.add("-cp");
|
args.add("-cp");
|
||||||
args.add(String.join(IOHelper.PLATFORM_SEPARATOR, context.classpath));
|
args.add(String.join(IOHelper.PLATFORM_SEPARATOR, context.classpath));
|
||||||
args.add(context.mainClass);
|
args.add(context.mainClass);
|
||||||
|
|
Loading…
Reference in a new issue