mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FEATURE] Указание аргументов для сервера
This commit is contained in:
parent
64cf9788d9
commit
795bca03a3
1 changed files with 14 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue