Class ServerJarInstaller
- Namespace
- McServerLauncher.Services
- Assembly
- McServerLauncher.dll
Puts the right server files on disk for a server type, whichever way that type is obtained.
public class ServerJarInstaller
- Inheritance
-
ServerJarInstaller
- Inherited Members
Remarks
The ways differ more than they look: Vanilla, Paper and Purpur are a jar to download, Fabric is a jar the loader builds for a version pair, and Forge and NeoForge run an installer that leaves no runnable jar at all and must be launched through an args file instead.
This chain used to exist twice, spelled out inline in the create-server dialog and again in the change-loader dialog. Every type added had to be added to both, and a type present in one and missing from the other fell through to "download the vanilla jar" without complaining — you would pick Purpur and quietly get Vanilla.
Constructors
ServerJarInstaller(MinecraftVersionService?, ModLoaderService?, PaperService?, PurpurService?, ServerCreationService?)
public ServerJarInstaller(MinecraftVersionService? versions = null, ModLoaderService? mods = null, PaperService? paper = null, PurpurService? purpur = null, ServerCreationService? creation = null)
Parameters
versionsMinecraftVersionServicemodsModLoaderServicepaperPaperServicepurpurPurpurServicecreationServerCreationService
Fields
Installable
Every type this can install. A type absent from here cannot be offered.
public static readonly ServerType[] Installable
Field Value
Remarks
Exposed so the picker and its test can be checked against reality rather than against a list written out a second time by hand.
Methods
InstallAsync(ServerType, string, string, VersionDetails, string, int, int, IProgress<string>?, bool, CancellationToken)
Installs type for a Minecraft version into folder.
public Task<ServerJarInstaller.InstallResult> InstallAsync(ServerType type, string folder, string mcVersion, MinecraftVersionService.VersionDetails details, string javaPath, int minRamGb, int maxRamGb, IProgress<string>? log, bool writeLoaderJvmArgs = true, CancellationToken ct = default)
Parameters
typeServerTypefolderstringmcVersionstringdetailsMinecraftVersionService.VersionDetailsjavaPathstringminRamGbintmaxRamGbintlogIProgress<string>writeLoaderJvmArgsboolctCancellationToken
Returns
Remarks
The RAM figures are here because Forge and NeoForge need them written into
user_jvm_args.txt during the install — their own run script reads that file, and
without it the server ignores the memory the user asked for.
writeLoaderJvmArgs exists for the one caller that must not touch it: the
change-loader dialog offers to keep a run script the user wrote themselves, and overwriting
the memory settings it reads would quietly undo their edit.