Class ServerProvisioningService
- Namespace
- McServerLauncher.Services
- Assembly
- McServerLauncher.dll
Makes a server on disk, or takes over a folder that already holds one: everything the new-server panel does once the form has been accepted.
public sealed class ServerProvisioningService
- Inheritance
-
ServerProvisioningService
- Inherited Members
Remarks
This used to be written into the panel's click handlers, so the only way to run the create path
was through a window. Here it is the same steps in the same order, with the screen replaced by a
log callback: the panel keeps what is about the form (checking it, the busy state, the
warnings) and this keeps what is about the files. It never shows anything itself — a failure is an
exception for the caller to word.
The steps are the ones the panel has always taken: resolve the version, make sure the Java that
version needs exists (the Forge installer needs it too), install the jar, then write the EULA, the
launch script and server.properties.
Constructors
ServerProvisioningService(MinecraftVersionService?, ServerJarInstaller?, ServerCreationService?, JavaService?)
public ServerProvisioningService(MinecraftVersionService? versions = null, ServerJarInstaller? installer = null, ServerCreationService? creation = null, JavaService? java = null)
Parameters
versionsMinecraftVersionServiceinstallerServerJarInstallercreationServerCreationServicejavaJavaService
Methods
AdoptAsync(ExistingServerForm, ServerDetection, int, MinecraftVersion?, bool, Action<string>)
Takes over a folder that already holds a server: nothing downloaded, nothing installed, nothing written but the port if it was changed and the EULA if the user accepted it here.
public Task<ServerConfig> AdoptAsync(ExistingServerForm form, ServerDetection found, int port, MinecraftVersion? version, bool writeEula, Action<string> log)
Parameters
formExistingServerFormWhat the form says about the folder.
foundServerDetectionWhat the folder turned out to contain.
portintThe port chosen in the form.
versionMinecraftVersionThe version picked, or null when Mojang's list does not know it.
writeEulaboolTrue only when the EULA box was there to tick and was ticked.
logAction<string>Told what is happening, line by line.
Returns
CreateAsync(NewServerPlan, Action<string>)
Creates the server described by plan and returns its configuration, ready to
register.
public Task<ServerConfig> CreateAsync(NewServerPlan plan, Action<string> log)
Parameters
planNewServerPlanThe form, already checked.
logAction<string>Told what is happening, line by line. Called on the caller's context.