Skip to content

Class IntegerArgumentType

Namespace: Void.Minecraft.Commands.Brigadier.ArgumentTypes
Assembly: Void.Minecraft.dll

Parses signed 32-bit integers constrained to an inclusive range.

public record IntegerArgumentType : IArgumentType, IAnyArgumentType, IEquatable<IntegerArgumentType>

Inheritance

objectIntegerArgumentType

Implements

IArgumentType, IAnyArgumentType, IEquatable<IntegerArgumentType>

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Properties

Examples

Gets representative valid input strings.

public IEnumerable<string> Examples { get; }

Property Value

IEnumerable<string>

Maximum

Gets the inclusive maximum.

public required int Maximum { get; init; }

Property Value

int

Minimum

Gets the inclusive minimum.

public required int Minimum { get; init; }

Property Value

int

Methods

GetInteger(CommandContext, string)

Gets a parsed integer argument from a context.

public static int GetInteger(CommandContext context, string name)

Parameters

context CommandContext

The command context.

name string

The argument name.

Returns

int

The parsed integer.

IntegerArgument()

Creates an argument accepting the complete 32-bit integer range.

public static IntegerArgumentType IntegerArgument()

Returns

IntegerArgumentType

The argument type.

IntegerArgument(int)

Creates an argument with a minimum and no narrower maximum.

public static IntegerArgumentType IntegerArgument(int min)

Parameters

min int

The inclusive minimum.

Returns

IntegerArgumentType

The argument type.

IntegerArgument(int, int)

Creates an argument with explicit inclusive bounds.

public static IntegerArgumentType IntegerArgument(int min, int max)

Parameters

min int

The inclusive minimum.

max int

The inclusive maximum.

Returns

IntegerArgumentType

The argument type. The bounds are retained without validation.

Parse(StringReader)

Parses a value from the reader’s current cursor.

public IArgumentValue Parse(StringReader reader)

Parameters

reader StringReader

The command reader to consume.

Returns

IArgumentValue

The parsed argument value.