Class Suggestion
Namespace: Void.Minecraft.Commands.Brigadier.Suggestion
Assembly: Void.Minecraft.dll
Describes text that replaces an input range, with an optional tooltip.
public record Suggestion : IComparable<Suggestion>, IEquatable<Suggestion>Inheritance
Derived
Implements
IComparable<Suggestion>, IEquatable<Suggestion>
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Constructors
Suggestion(StringRange, string, IMessage?)
Describes text that replaces an input range, with an optional tooltip.
public Suggestion(StringRange Range, string Text, IMessage? Tooltip = null)Parameters
Range StringRange
The half-open range replaced by the suggestion.
Text string
The replacement text.
Tooltip IMessage?
The optional display tooltip.
Properties
Range
The half-open range replaced by the suggestion.
public StringRange Range { get; init; }Property Value
Text
The replacement text.
public string Text { get; init; }Property Value
Tooltip
The optional display tooltip.
public IMessage? Tooltip { get; init; }Property Value
Methods
Apply(string)
Applies this replacement to a source string.
public string Apply(string source)Parameters
source string
The complete input.
Returns
The input with
CompareTo(Suggestion?)
Compares suggestion text using ordinal ordering.
public int CompareTo(Suggestion? other)Parameters
other Suggestion?
The other suggestion, whose absent text compares as null.
Returns
The ordinal comparison result.
Expand(string, StringRange)
Expands this suggestion to cover a containing range by retaining intervening source text.
public Suggestion Expand(string source, StringRange range)Parameters
source string
The complete input.
range StringRange
The new replacement range.
Returns
This instance when ranges match; otherwise an expanded suggestion.