From 795bca03a3849c131cc9efaff4080bea2d1a94af Mon Sep 17 00:00:00 2001 From: Gravit Date: Tue, 5 Feb 2019 18:33:53 +0700 Subject: [PATCH] =?UTF-8?q?[FEATURE]=20=D0=A3=D0=BA=D0=B0=D0=B7=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B0=D1=80=D0=B3=D1=83=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=BE=D0=B2=20=D0=B4=D0=BB=D1=8F=20=D1=81=D0=B5=D1=80?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gravit/launcher/server/ServerWrapper.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerWrapper.java b/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerWrapper.java index 8ee17b3d..fbe62880 100644 --- a/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerWrapper.java +++ b/ServerWrapper/src/main/java/ru/gravit/launcher/server/ServerWrapper.java @@ -152,14 +152,24 @@ public static void main(String... args) throws Throwable { if (loader != null) mainClass = Class.forName(classname, true, loader); else mainClass = Class.forName(classname); MethodHandle mainMethod = MethodHandles.publicLookup().findStatic(mainClass, "main", MethodType.methodType(void.class, String[].class)); - String[] real_args = new String[args.length - 1]; - System.arraycopy(args, 1, real_args, 0, args.length - 1); modulesManager.postInitModules(); LogHelper.info("ServerWrapper: Project %s, LaunchServer address: %s port %d. Title: %s", config.projectname, config.address, config.port, config.title); LogHelper.info("Minecraft Version (for profile): %s", wrapper.profile == null ? "unknown" : wrapper.profile.getVersion().name); LogHelper.info("Start Minecraft Server"); LogHelper.debug("Invoke main method %s", mainClass.getName()); - mainMethod.invoke(real_args); + if(config.args == null) + { + String[] real_args = new String[args.length - 1]; + System.arraycopy(args, 1, real_args, 0, args.length - 1); + Object[] args_array = { real_args }; + mainMethod.invoke(args_array); + } + + else + { + Object[] args_array = { config.args }; + mainMethod.invoke(args_array); + } } private static void generateConfigIfNotExists() throws IOException { @@ -207,6 +217,7 @@ public static final class Config { public String librariesDir; public String mainclass; public String login; + public String[] args; public String password; public LauncherConfig.LauncherEnvironment env; }