Table of Contents

Class PerformanceProbe

Namespace
McServerLauncher.Services
Assembly
McServerLauncher.dll

Asks a running server how fast it is, with the best command it understands, and keeps the answer out of the console.

public sealed class PerformanceProbe
Inheritance
PerformanceProbe
Inherited Members

Remarks

The commands are typed into the server's console like anything the owner would type, so their answers come back as ordinary console lines. Printing them every 30 seconds would bury the console, so for the few seconds after asking, the lines that are the answer are recognised by their exact shape (PerformanceParsers) and swallowed: they reach neither the screen, nor the log on disk, nor the player history. Anything else that happens to arrive in those seconds goes through untouched.

If a command is unknown, or three asks in a row get no answer, the next one is tried. If something the owner typed arrives while a probe is waiting, Disarm() is called, so what they asked for is shown to them; the probe simply asks again later.

The output of spark tps and tick query goes to whoever ran the command, which here is the console, so operators in the game do not see it (checked on 2026-10-22 with an operator connected to a Paper server).

Constructors

PerformanceProbe(IReadOnlyList<ProbeKind>)

public PerformanceProbe(IReadOnlyList<ProbeKind> candidates)

Parameters

candidates IReadOnlyList<ProbeKind>

Fields

Window

How long after asking an answer is looked for.

public static readonly TimeSpan Window

Field Value

TimeSpan

Properties

Armed

True while the probe is waiting for an answer.

public bool Armed { get; }

Property Value

bool

Current

The command being tried, or null when none is left.

public ProbeKind? Current { get; }

Property Value

ProbeKind?

Methods

Ask(DateTime)

Starts asking. Returns the command to type, or null when there is nothing left to try. A previous ask that got no answer counts as a miss.

public string? Ask(DateTime now)

Parameters

now DateTime

Returns

string

Candidates(ServerType, string?, bool)

The commands worth trying for a server, best first.

public static IReadOnlyList<ProbeKind> Candidates(ServerType type, string? gameVersion, bool sparkInstalled)

Parameters

type ServerType

The server type.

gameVersion string

Its Minecraft version, such as 1.21.1 or 26.2.

sparkInstalled bool

A spark jar is in its mods or plugins folder.

Returns

IReadOnlyList<ProbeKind>

Command(ProbeKind)

The text to type for a kind of probe.

public static string Command(ProbeKind kind)

Parameters

kind ProbeKind

Returns

string

Disarm()

Stops waiting, so the next lines are shown. Called when the owner types something.

public void Disarm()

TryConsume(string, DateTime, out TickReading?)

Offers a console line to the probe. Returns true when the line is part of the answer and must not be shown; reading is set on the line that completes it.

public bool TryConsume(string line, DateTime now, out TickReading? reading)

Parameters

line string
now DateTime
reading TickReading

Returns

bool

VersionAtLeast(string?, int, int, int)

True when the game version is at least the one given. Versions from 26 on, which dropped the leading 1, are later than any 1.x.

public static bool VersionAtLeast(string? version, int major, int minor, int patch)

Parameters

version string
major int
minor int
patch int

Returns

bool