BloodyMods / ServerStarter

MIT License
100 stars 64 forks source link

[forge 1.18.2 server] Additional fml arguments not passed #65

Open mrossi80 opened 2 years ago

mrossi80 commented 2 years ago

Hello,

i'm using serverstarter-2.3.1.jar

I have a 1.18.2 server, Forge 40.1.16.

I need to add two additional arguments to target 'forgeserver'.

--fml.mavenRoots ../modsrepo --fml.modLists ../modsrepo/server.list

I expected them to work, if i add them to startCommand section.

  startCommand:
    - "@libraries/net/minecraftforge/forge/{{@mcversion@}}-{{@loaderversion@}}/{{@os@}}_args.txt"
    - "nogui"
    - "fml.mavenRoots ../modsrepo"
    - "fml.modLists ../modsrepo/server.list"

They're indeed recognized but take no effect

[11:37:38] [main/INFO]: Launching target 'forgeserver' with arguments [nogui, fml.mavenRoots ../modsrepo, fml.modLists ../modsrepo/server.list]

To make them effective, i have to add them to "winargs.txt" file.

[.....]
--launchTarget forgeserver
--fml.forgeVersion 40.1.16
--fml.mcVersion 1.18.2
--fml.forgeGroup net.minecraftforge
--fml.mcpVersion 20220404.173914
--fml.mavenRoots ../modsrepo
--fml.modLists ../modsrepo/server.list

Is it an expected behiavour? Or is it expected that the arguments in startCommand should be properly managed?

Thanks

YoYoK3nny commented 2 years ago
  startCommand:
    - "@libraries/net/minecraftforge/forge/{{@mcversion@}}-{{@loaderversion@}}/{{@os@}}_args.txt"
    - "nogui"
    - "fml.mavenRoots ../modsrepo"
    - "fml.modLists ../modsrepo/server.list"

Shouldn't that be

  startCommand:
    - "@libraries/net/minecraftforge/forge/{{@mcversion@}}-{{@loaderversion@}}/{{@os@}}_args.txt"
    - "--fml.mavenRoots ../modsrepo"
    - "--fml.modLists ../modsrepo/server.list"
    - "nogui"

to get the desired effect and keep the arguments in the same order as if you added the extras to win_args.txt manually?

mrossi80 commented 2 years ago

Thank you for the reply and the support.

I removed the lines in win_args.txt and added them, as suggested, to server-setup-config.yaml

The server crashes

[22:05:14] [INFO] Starting Loader, output incoming
[22:05:16] [main/INFO]: ModLauncher running: args [--launchTarget, forgeserver, --fml.forgeVersion, 40.1.16, --fml.mcVersion, 1.18.2, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20220404.173914, --fml.mavenRoots ../modsrepo, --fml.modLists ../modsrepo/server.list, nogui]
[22:05:16] [main/INFO]: ModLauncher 9.1.3+9.1.3+main.9b69c82a starting: java version 17.0.1 by Oracle Corporation
[22:05:16] [main/INFO]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/D:/Owncloud/mc-server-crafting/server/libraries/org/spongepowered/mixin/0.8.5/mixin-0.8.5.jar%2314!/ Service=ModLauncher Env=SERVER
[22:05:16] [main/INFO]: Found mod file fmlcore-1.18.2-40.1.16.jar of type LIBRARY with locator net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@5b04476e
[22:05:16] [main/INFO]: Found mod file javafmllanguage-1.18.2-40.1.16.jar of type LANGPROVIDER with locator net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@5b04476e
[22:05:16] [main/INFO]: Found mod file mclanguage-1.18.2-40.1.16.jar of type LANGPROVIDER with locator net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@5b04476e
[22:05:16] [main/INFO]: Found mod file server-1.18.2-20220404.173914-srg.jar of type MOD with locator net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@5b04476e
[22:05:16] [main/INFO]: Found mod file forge-1.18.2-40.1.16-universal.jar of type MOD with locator net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@5b04476e
[22:05:18] [main/INFO]: Launching target 'forgeserver' with arguments [--fml.mavenRoots ../modsrepo, --fml.modLists ../modsrepo/server.list, nogui]
[22:05:18] [main/ERROR]: Failed to start the minecraft server
joptsimple.UnrecognizedOptionException: fml.mavenRoots ../modsrepo is not a recognized option
        at joptsimple.OptionException.unrecognizedOption(OptionException.java:108) ~[jopt-simple-5.0.4.jar%2332!/:?]
        at joptsimple.OptionParser.handleLongOptionToken(OptionParser.java:510) ~[jopt-simple-5.0.4.jar%2332!/:?]
        at joptsimple.OptionParserState$2.handleArgument(OptionParserState.java:56) ~[jopt-simple-5.0.4.jar%2332!/:?]
        at joptsimple.OptionParser.parse(OptionParser.java:396) ~[jopt-simple-5.0.4.jar%2332!/:?]
        at net.minecraft.server.Main.main(Main.java:91) ~[server-1.18.2-20220404.173914-srg.jar%2339!/:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
        at net.minecraftforge.fml.loading.targets.CommonServerLaunchHandler.lambda$launchService$0(CommonServerLaunchHandler.java:32) ~[fmlloader-1.18.2-40.1.16.jar%2316!/:?]
        at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.1.3.jar%235!/:?]
        at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.1.3.jar%235!/:?]
        at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.1.3.jar%235!/:?]
        at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.1.3.jar%235!/:?]
        at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.1.3.jar%235!/:?]
        at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.1.3.jar%235!/:?]
        at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.1.3.jar%235!/:?]
        at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:149) [bootstraplauncher-1.0.0.jar:?]

I see in the arguments dump (line 2)

--fml.mcpVersion, 20220404.173914, --fml.mavenRoots ../modsrepo,

I see there is a comma between fml.mcpVersion and 20220404.173914, but no comma between fml.mavenRoots and ../modsrepo

So i decided to further divide arguments and parameters.

  startCommand:
    - "@libraries/net/minecraftforge/forge/{{@mcversion@}}-{{@loaderversion@}}/{{@os@}}_args.txt"
    - "--fml.mavenRoots"
    - "../modsrepo"
    - "--fml.modLists"
    - "../modsrepo/server.list"
    - "nogui"

And now it indeed works!

I humbly suggest to "document better" this "unintuitive approach".

At least for me, the "issue" can be closed; or if you prefer, you may handle argument parameters in a different way.

Thank you anyway.

YoYoK3nny commented 2 years ago

Thinking about it, that actually makes perfect sense that it works that way.

The win_args.txt is really just an array of arguments stored in an external file. startCommand is also an array, so would need the same argument separation. This includes separating the option values from their respective options.

The final argument handling is handled by forge itself, so it'll be better to add some more intuitive documentation to the config file comments.