Class PlayerNames
- Namespace
- McServerLauncher.Services
- Assembly
- McServerLauncher.dll
What a Minecraft Java player name looks like, in one place.
public static class PlayerNames
- Inheritance
-
PlayerNames
- Inherited Members
Remarks
Letters, digits and underscore, one to sixteen of them. Five classes each kept their own regex for this; they agreed, but the next one to change would have to find the other four. The rule matters beyond looks: it is what stops a name from carrying a line break into a console command, and from ever becoming part of a path.
Fields
Pattern
The rule as a regex fragment, for patterns that pick a name out of a line.
public const string Pattern = "[A-Za-z0-9_]{1,16}"
Field Value
Methods
IsValid(string?)
Whether name is, exactly, a name Minecraft would accept.
public static bool IsValid(string? name)
Parameters
namestring
Returns
Remarks
Not a regex: $ also matches before a final line break, so "Alice\n" passed.