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; }