Skip to content

API reference / @jsprismarine/brigadier / ArgumentBuilder

Abstract Class: ArgumentBuilder<S, T> ​

Defined in: brigadier/src/builder/ArgumentBuilder.ts:11

Builds a command node: its children, the command it runs, its requirement and where it redirects.

Extended by ​

Type Parameters ​

S ​

S

T ​

T extends ArgumentBuilder<S, T>

Constructors ​

Constructor ​

new ArgumentBuilder<S, T>(): ArgumentBuilder<S, T>

Returns ​

ArgumentBuilder<S, T>

Methods ​

build() ​

abstract build(): CommandNode<S>

Defined in: brigadier/src/builder/ArgumentBuilder.ts:108

Builds the node.

Returns ​

CommandNode<S>


executes() ​

executes(command): T

Defined in: brigadier/src/builder/ArgumentBuilder.ts:45

Sets the command the node runs when the input ends on it.

Parameters ​

command ​

Command<S>

Returns ​

T


fork() ​

fork(target, modifier): T

Defined in: brigadier/src/builder/ArgumentBuilder.ts:76

Sends the rest of the input to target once for each source modifier returns.

Parameters ​

target ​

CommandNode<S>

modifier ​

RedirectModifier<S>

Returns ​

T


forward() ​

forward(target, modifier, fork): T

Defined in: brigadier/src/builder/ArgumentBuilder.ts:81

Sets the redirect target, its source modifier and whether it forks. Throws on a builder with children.

Parameters ​

target ​

CommandNode<S>

modifier ​

RedirectModifier<S> | null

fork ​

boolean

Returns ​

T


getArguments() ​

getArguments(): Iterable<CommandNode<S>>

Defined in: brigadier/src/builder/ArgumentBuilder.ts:40

Returns the child nodes added so far.

Returns ​

Iterable<CommandNode<S>>


getCommand() ​

getCommand(): Command<S>

Defined in: brigadier/src/builder/ArgumentBuilder.ts:51

Returns the command the node runs.

Returns ​

Command<S>


getRedirect() ​

getRedirect(): CommandNode<S> | null

Defined in: brigadier/src/builder/ArgumentBuilder.ts:93

Returns the node the input is redirected to, or null.

Returns ​

CommandNode<S> | null


getRedirectModifier() ​

getRedirectModifier(): RedirectModifier<S> | null

Defined in: brigadier/src/builder/ArgumentBuilder.ts:98

Returns the modifier applied to the source on a redirect, or null.

Returns ​

RedirectModifier<S> | null


getRequirement() ​

getRequirement(): Predicate<S>

Defined in: brigadier/src/builder/ArgumentBuilder.ts:62

Returns the predicate a source must pass to use the node.

Returns ​

Predicate<S>


getThis() ​

abstract getThis(): T

Defined in: brigadier/src/builder/ArgumentBuilder.ts:25

Returns this builder as its concrete type, so the chained methods keep it.

Returns ​

T


isFork() ​

isFork(): boolean

Defined in: brigadier/src/builder/ArgumentBuilder.ts:103

Returns whether the redirect runs once for each source the modifier returns.

Returns ​

boolean


redirect() ​

redirect(target, modifier?): T

Defined in: brigadier/src/builder/ArgumentBuilder.ts:67

Sends the rest of the input to target, optionally changing the source on the way.

Parameters ​

target ​

CommandNode<S>

modifier? ​

SingleRedirectModifier<S>

Returns ​

T


requires() ​

requires(requirement): T

Defined in: brigadier/src/builder/ArgumentBuilder.ts:56

Sets the predicate a source must pass to use the node.

Parameters ​

requirement ​

Predicate<S>

Returns ​

T


then() ​

then(arg): T

Defined in: brigadier/src/builder/ArgumentBuilder.ts:28

Adds a child node, or the node a child builder builds. Throws on a builder that redirects.

Parameters ​

arg ​

CommandNode<S> | ArgumentBuilder<S, any>

Returns ​

T