Skip to content

ApiVersion

Namespace Mc.Scripting · Kind struct (readonly)

public readonly struct ApiVersion : IComparable<ApiVersion>, IEquatable<ApiVersion>

The version of the plugin API (semantic: a minor increase is additive, a major increase is breaking).

Member Description
ApiVersion(int Major, int Minor) The version of the plugin API (semantic: a minor increase is additive, a major increase is breaking).
public ApiVersion(int Major, int Minor)

The version of the plugin API (semantic: a minor increase is additive, a major increase is breaking).

Parameters

Name Type Description
Major int Breaking changes.
Minor int Additive changes.
Member Description
int Major { get; init; } Breaking changes.
int Minor { get; init; } Additive changes.
static ApiVersion Current { get; } The API version this server provides.
public int Major { get; init; }

Breaking changes.

public int Minor { get; init; }

Additive changes.

public static ApiVersion Current { get; }

The API version this server provides.

Member Description
int CompareTo(ApiVersion other)
bool Satisfies(ApiVersion required) Whether a plugin that needs required can run on this server version.
override string ToString()
static bool TryParse(string? text, out ApiVersion version) Parses “1.0”, “1” or “1.x”.
public int CompareTo(ApiVersion other)

Parameters

Name Type Description
other ApiVersion

Returns int

public bool Satisfies(ApiVersion required)

Whether a plugin that needs required can run on this server version.

Parameters

Name Type Description
required ApiVersion

Returns bool

public override string ToString()

Returns string

public static bool TryParse(string? text, out ApiVersion version)

Parses “1.0”, “1” or “1.x”.

Parameters

Name Type Description
text string? The text.
version out ApiVersion The result.

Returns bool: True when the text is a valid version.