Table of Contents

Class ServerNameRule

Namespace
McServerLauncher.Services
Assembly
McServerLauncher.dll

Checking a server's folder name before it becomes a server that will not start.

public static class ServerNameRule
Inheritance
ServerNameRule
Inherited Members

Remarks

The app used to strip whatever Windows forbids and say nothing: type Mi:Server and a folder called MiServer appeared, with no hint that the name had been altered. Nothing else was checked at all, and the parent folder was never looked at — which is how a server sat in Java+Bedrock for weeks and then refused to start the day it became Paper.

The list of characters a server refuses is deliberately short, and it was measured rather than guessed: a real Paper server was started in a folder named after each of twenty-one candidates. Only ! and + failed. #, &, %, ^, ~, ', ;, ,, =, @, $, brackets, braces, parentheses, spaces, accents, underscores and dots all ran fine. Banning those on suspicion would have refused names like Server (2026) or Iberia #2 for no reason at all.

Methods

Check(string?, ServerType)

The first problem with the folder a server would live in, or null when there is none.

public static NameIssue? Check(string? folderPath, ServerType type)

Parameters

folderPath string

The full path the server folder would have.

type ServerType

The server type, which decides whether the software adds rules of its own.

Returns

NameIssue

Remarks

Ordered by how fundamental each problem is: a name Windows cannot create at all is reported before one that merely stops Paper, because fixing the second would leave the first.

Clean(string?)

The name with the characters Windows forbids taken out, and trailing dots and spaces trimmed.

public static string Clean(string? name)

Parameters

name string

Returns

string

Remarks

Offered as a suggestion now rather than applied behind the user's back. The old behaviour silently produced a folder with a different name from the one they typed.