Table of Contents

Class ServerCreationService

Namespace
McServerLauncher.Services
Assembly
McServerLauncher.dll

Generates the initial files of a new server: eula.txt, run.bat and a minimal server.properties with the chosen port (Minecraft fills in the rest on the first launch).

public class ServerCreationService
Inheritance
ServerCreationService
Inherited Members

Methods

EulaAccepted(string)

Whether eula.txt in folder already says the EULA was accepted.

public static bool EulaAccepted(string folder)

Parameters

folder string

Returns

bool

WorldExists(string)

Whether the folder already holds a generated world, which a seed can no longer change.

public static bool WorldExists(string folder)

Parameters

folder string

Returns

bool

WriteEula(string)

Writes eula.txt with the EULA accepted.

public void WriteEula(string folder)

Parameters

folder string

Remarks

Only once the user has ticked the box that says so: accepting it is theirs to do, and the app used to write this on their behalf with nothing on screen but a line in the progress log.

WriteForgeUserJvmArgs(string, int, int)

Writes user_jvm_args.txt with the configured RAM. Modern Forge's own run.bat/run.sh read this file, so launching outside the app uses the same memory settings.

public void WriteForgeUserJvmArgs(string folder, int minGb, int maxGb)

Parameters

folder string
minGb int
maxGb int

WriteInitialProperties(string, int, string, string?)

Writes a minimal server.properties with the port, the MOTD and the whitelist off, if it doesn't exist yet. Minecraft fills in the rest of the default properties on startup.

public void WriteInitialProperties(string folder, int port, string motd, string? seed = null)

Parameters

folder string

The new server's folder.

port int

The port it listens on.

motd string

The message the server list shows.

seed string

The seed typed when creating it, or null or blank for a random one. Written as level-seed, which the server reads once, when it generates the world.

Remarks

The whitelist is written because Minecraft's own default for it changed: up to 26.2 a new server was open, and from 26.3 it starts with white-list=true and an empty list, so nobody at all can get in — the owner included, until they find the setting. Somebody who wants a private server turns it on, or adds a first name, which turns it on by itself.

WriteRunBat(string, int, int, string, string)

Creates a run.bat equivalent to the one you would use manually (in case you want to launch it outside the app).

public void WriteRunBat(string folder, int minGb, int maxGb, string jarFile, string javaPath = "java")

Parameters

folder string
minGb int
maxGb int
jarFile string
javaPath string