Class ArgumentCommandNode
Namespace: Void.Minecraft.Commands.Brigadier.Tree.Nodes
Assembly: Void.Minecraft.dll
Represents a named argument in a Brigadier command tree.
public class ArgumentCommandNode : CommandNode, ICommandNodeInheritance
object ← CommandNode ← ArgumentCommandNode
Implements
Inherited Members
CommandNode.IsForks, CommandNode.Requirement, CommandNode.Executor, CommandNode.RedirectTarget, CommandNode.RedirectModifier, CommandNode.Children, CommandNode.Name, CommandNode.UsageText, CommandNode.Examples, CommandNode.SortedKey, CommandNode.AddChild(CommandNode), CommandNode.CanUseAsync(ICommandSource, CancellationToken), CommandNode.FindAmbiguities(AmbiguousConsumer), CommandNode.GetChild(string), CommandNode.RemoveChild(string), CommandNode.GetRelevantNodes(StringReader), CommandNode.CreateBuilder(), CommandNode.IsValidInput(string), CommandNode.ListSuggestionsAsync(CommandContext, SuggestionsBuilder, CancellationToken), CommandNode.Parse(StringReader, CommandContextBuilder), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Remarks
An argument node consumes input by delegating parsing and completion behavior to its configured name, and usage text is rendered as <name>.
Constructors
ArgumentCommandNode(string, IArgumentType, CommandExecutor?, CommandRequirement?, CommandNode?, RedirectModifier?, bool, SuggestionProvider?)
Represents a named argument in a Brigadier command tree.
public ArgumentCommandNode(string name, IArgumentType type, CommandExecutor? executor, CommandRequirement? requirement, CommandNode? redirectTarget, RedirectModifier? redirectModifier, bool isForks, SuggestionProvider? customSuggestions)Parameters
name string
The argument name used in command contexts, usage text, and child-node lookup.
type IArgumentType
The argument type that parses input, supplies examples, and provides default suggestions.
executor CommandExecutor?
The command executor invoked when parsing completes at this node, or null when the node is not executable.
requirement CommandRequirement?
The predicate that controls whether a source can use this node, or null to allow all sources.
redirectTarget CommandNode?
The node to redirect execution to, or null when this node does not redirect.
redirectModifier RedirectModifier?
The modifier that maps a command context to redirected sources, or null when no redirect modifier is used.
isForks bool
A value indicating whether redirects from this node fork execution to multiple sources.
customSuggestions SuggestionProvider?
The custom suggestion provider for this argument, or null to use type suggestions.
Remarks
An argument node consumes input by delegating parsing and completion behavior to its configured name, and usage text is rendered as <name>.
Properties
CustomSuggestions
Gets or sets the custom completion provider, or null to delegate to
public SuggestionProvider? CustomSuggestions { get; set; }Property Value
Examples
Gets representative input strings for this argument node.
public override IEnumerable<string> Examples { get; }Property Value
Remarks
The sequence is provided by
Name
Gets the name used to index this node under its parent.
public override string Name { get; }Property Value
SortedKey
Gets the key used when ordering nodes.
protected override string SortedKey { get; }Property Value
Type
Gets the parser and default completion behavior.
public IArgumentType Type { get; }Property Value
UsageText
Gets the fragment displayed in command usage.
public override string UsageText { get; }Property Value
Methods
CreateBuilder()
Creates a builder initialized from this node.
public override IArgumentBuilder<CommandNode> CreateBuilder()Returns
The configured builder.
IsValidInput(string)
Determines whether this node can consume a complete sample input.
public override bool IsValidInput(string input)Parameters
input string
The sample input.
Returns
Whether the input is valid.
ListSuggestionsAsync(CommandContext, SuggestionsBuilder, CancellationToken)
Lists completions for this node.
public override ValueTask<Suggestions> ListSuggestionsAsync(CommandContext context, SuggestionsBuilder builder, CancellationToken cancellationToken)Parameters
context CommandContext
The parsed context.
builder SuggestionsBuilder
The suggestion builder.
cancellationToken CancellationToken
A cancellation token.
Returns
The suggestions.
Parse(StringReader, CommandContextBuilder)
Parses this argument from the current position of reader and records the parsed value in contextBuilder.
public override void Parse(StringReader reader, CommandContextBuilder contextBuilder)Parameters
reader StringReader
The input reader positioned at the beginning of the argument value to parse.
contextBuilder CommandContextBuilder
The command context builder that receives the parsed argument and node range.
Remarks
Parsing is delegated to
Exceptions
The configured
ToString()
Returns a diagnostic representation containing the name and argument type.
public override string ToString()Returns
The diagnostic representation.