mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-04-29 22:24:26 +02:00
Pass mainclass and gameargs to the main game via system properties
Signed-off-by: Xander <xander@isxander.dev>
This commit is contained in:
parent
60e279bf39
commit
a702d06cd8
@ -97,6 +97,18 @@ public final class StandardLauncher extends AbstractLauncher {
|
||||
gameArgs.add(worldName);
|
||||
}
|
||||
|
||||
StringBuilder joinedGameArgs = new StringBuilder();
|
||||
for (String gameArg : gameArgs) {
|
||||
if (joinedGameArgs.length() > 0) {
|
||||
joinedGameArgs.append(" ");
|
||||
}
|
||||
joinedGameArgs.append(gameArg);
|
||||
}
|
||||
|
||||
// pass the real main class and game arguments in so mods can access them
|
||||
System.setProperty("org.prismlauncher.launch.mainclass", mainClassName);
|
||||
System.setProperty("org.prismlauncher.launch.gameargs", joinedGameArgs.toString());
|
||||
|
||||
// find and invoke the main method
|
||||
MethodHandle method = ReflectionUtils.findMainMethod(mainClassName);
|
||||
method.invokeExact(gameArgs.toArray(new String[0]));
|
||||
|
Loading…
x
Reference in New Issue
Block a user