Class ArgumentBuilder<TBuilder, TNode>
Namespace: Void.Minecraft.Commands.Brigadier.Builder
Assembly: Void.Minecraft.dll
Provides fluent, strongly typed operations for a command-node builder.
public abstract record ArgumentBuilder<TBuilder, TNode> : ArgumentBuilder, IEquatable<ArgumentBuilder>, IArgumentBuilder<TNode>, IEquatable<ArgumentBuilder<TBuilder, TNode>> where TBuilder : ArgumentBuilder<TBuilder, TNode> where TNode : CommandNodeType Parameters
TBuilder
The concrete builder type.
TNode
The produced node type.
Inheritance
object ← ArgumentBuilder ← ArgumentBuilder<TBuilder, TNode>
Implements
IEquatable<ArgumentBuilder>, IArgumentBuilder<TNode>, IEquatable<ArgumentBuilder<TBuilder, TNode>>
Inherited Members
ArgumentBuilder._arguments, ArgumentBuilder.Executor, ArgumentBuilder.RedirectModifier, ArgumentBuilder.RedirectTarget, ArgumentBuilder.IsForks, ArgumentBuilder.Requirement, ArgumentBuilder.Arguments, ArgumentBuilder.Build(), ArgumentBuilder.Executes(CommandExecutor?), ArgumentBuilder.Executes(CommandExecutorSync?), ArgumentBuilder.Requires(CommandRequirement?), ArgumentBuilder.Redirect(CommandNode), ArgumentBuilder.Redirect(CommandNode, SingleRedirectModifier), ArgumentBuilder.Fork(CommandNode, RedirectModifier), ArgumentBuilder.Forward(CommandNode?, RedirectModifier?, bool), ArgumentBuilder.Suggests(SuggestionProvider?), ArgumentBuilder.AddChild(CommandNode), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Methods
Build()
Creates the configured command node.
public override abstract TNode Build()Returns
TNode
The built node.
Executes(CommandExecutor?)
Sets an asynchronous executor and returns the concrete builder type.
public TBuilder Executes(CommandExecutor? command)Parameters
command CommandExecutor?
The executor, or null.
Returns
TBuilder
This builder.
Executes(CommandExecutorSync?)
Sets a synchronous executor and returns the concrete builder type.
public TBuilder Executes(CommandExecutorSync? command)Parameters
command CommandExecutorSync?
The executor, or null to leave it unchanged.
Returns
TBuilder
This builder.
Fork(CommandNode, RedirectModifier)
Configures a forking redirect and returns the concrete builder type.
public TBuilder Fork(CommandNode target, RedirectModifier modifier)Parameters
target CommandNode
The redirect target.
modifier RedirectModifier
The source modifier.
Returns
TBuilder
This builder.
Forward(CommandNode?, RedirectModifier?, bool)
Sets redirect metadata and returns the concrete builder type.
public TBuilder Forward(CommandNode? target, RedirectModifier? modifier, bool fork)Parameters
target CommandNode?
The redirect target.
modifier RedirectModifier?
The source modifier.
fork bool
Whether execution forks.
Returns
TBuilder
This builder.
Redirect(CommandNode)
Configures a simple redirect and returns the concrete builder type.
public TBuilder Redirect(CommandNode target)Parameters
target CommandNode
The redirect target.
Returns
TBuilder
This builder.
Redirect(CommandNode, SingleRedirectModifier)
Redirects execution to target and uses modifier to map the redirected context to a single command source.
public TBuilder Redirect(CommandNode target, SingleRedirectModifier modifier)Parameters
target CommandNode
The command node to redirect to.
modifier SingleRedirectModifier
The callback used to produce the redirected command source for each execution context.
Returns
TBuilder
The current builder instance, typed as TBuilder.
Exceptions
Thrown when the builder already contains child nodes and cannot be redirected.
Requires(CommandRequirement?)
Sets the predicate that determines whether a command source can use the node produced by this builder.
public TBuilder Requires(CommandRequirement? requirement)Parameters
requirement CommandRequirement?
The asynchronous requirement delegate to store on the built command node, or null to allow every source.
Returns
TBuilder
The current builder instance, typed as TBuilder.
Suggests(SuggestionProvider?)
Sets a suggestion provider when supported and returns the concrete builder type.
public virtual TBuilder Suggests(SuggestionProvider? provider)Parameters
provider SuggestionProvider?
The provider.
Returns
TBuilder
This builder.
Then<TChildNode>(IArgumentBuilder<TChildNode>)
Builds and adds a child node.
public TBuilder Then<TChildNode>(IArgumentBuilder<TChildNode> argument) where TChildNode : CommandNodeParameters
argument IArgumentBuilder<TChildNode>
The child builder.
Returns
TBuilder
This builder.
Type Parameters
TChildNode
The child node type.
Exceptions
A redirect target is already configured.
Then<TChildNode>(CommandNode)
Adds an existing child node.
public TBuilder Then<TChildNode>(CommandNode node) where TChildNode : CommandNodeParameters
node CommandNode
The child node.
Returns
TBuilder
This builder.
Type Parameters
TChildNode
A command-node type used for fluent overload selection.
Exceptions
A redirect target is already configured.
Then<TChildNode>(Func<IArgumentContext, IArgumentBuilder<TChildNode>>)
Invokes a child-builder factory with the default argument context, builds it, and adds the result.
public TBuilder Then<TChildNode>(Func<IArgumentContext, IArgumentBuilder<TChildNode>> argument) where TChildNode : CommandNodeParameters
argument Func<IArgumentContext, IArgumentBuilder<TChildNode>>
The child-builder factory.
Returns
TBuilder
This builder.
Type Parameters
TChildNode
The child node type.
Exceptions
A redirect target is already configured.