Table of Contents

Class ServerDetectionService

Namespace
McServerLauncher.Services
Assembly
McServerLauncher.dll

Works out what kind of server a folder holds: the type, the Minecraft version, the loader, what to launch, and the port, memory and world it was set up with.

public class ServerDetectionService
Inheritance
ServerDetectionService
Inherited Members

Remarks

Two callers. Detect(string, string?) answers without touching anything, for the create dialog's "use a folder that already exists", which shows what it found before anything is saved. DetectAndFill(ServerConfig) fills in servers saved before the type and version were recorded, every time the app starts.

The order matters. NeoForge and Forge leave an args file under libraries/ and may have a stray jar in the root too, so they go first; Purpur before Paper, because a Purpur jar is not called paper-anything and used to fall all the way through to "Vanilla, version unknown" — even for the servers this app creates itself.

Methods

Detect(string, string?)

Everything that can be told about folder, without changing anything.

public ServerDetection Detect(string folder, string? preferredJar = null)

Parameters

folder string

The server's folder.

preferredJar string

A jar the caller already believes is the server, tried first for a plain vanilla folder.

Returns

ServerDetection

DetectAndFill(ServerConfig)

Detects and fills missing fields in place. Returns true if it changed the config.

public bool DetectAndFill(ServerConfig config)

Parameters

config ServerConfig

Returns

bool