CommandAPI 9.6.0
An API for the command UI introduced in Minecraft 1.13
|
A skeleton implementation of a Builder for CommandNode
s.
More...
Public Member Functions | |
T | then (final ArgumentBuilder< S, ?> argument) |
Builds the given ArgumentBuilder and adds the result as new child node. More... | |
T | then (final CommandNode< S > argument) |
Adds the given command node as a child. More... | |
Collection< CommandNode< S > > | getArguments () |
Returns all registered child command nodes. More... | |
T | executes (final Command< S > command) |
Sets the command that will be executed by the built command node. More... | |
Command< S > | getCommand () |
Returns the Command the built command node will execute. More... | |
T | requires (final Predicate< S > requirement) |
Sets the predicate that must be true for a command source in order to be able to use the built command node or its children. More... | |
Predicate< S > | getRequirement () |
Returns the requirement each command source must meet in order to be able to use this command node. More... | |
T | redirect (final CommandNode< S > target) |
Redirects this command node to the target CommandNode . More... | |
T | redirect (final CommandNode< S > target, final SingleRedirectModifier< S > modifier) |
Redirects this command node to the target CommandNode . More... | |
T | fork (final CommandNode< S > target, final RedirectModifier< S > modifier) |
Forks this command node, i.e. More... | |
T | forward (final CommandNode< S > target, final RedirectModifier< S > modifier, final boolean fork) |
Forwards this command in some way to a given target command. More... | |
CommandNode< S > | getRedirect () |
Returns the command node that the built command node redirects to. More... | |
RedirectModifier< S > | getRedirectModifier () |
Returns the redirect modifier for the built command node. More... | |
boolean | isFork () |
Returns whether the built command node forks. More... | |
abstract CommandNode< S > | build () |
Builds the CommandNode based on this builder. More... | |
Protected Member Functions | |
abstract T | getThis () |
Returns this argument builder. More... | |
A skeleton implementation of a Builder for CommandNode
s.
<S> | the type of the command source |
<T> | the type of the builder. Used to realize an emulated self type |
|
abstract |
Builds the CommandNode
based on this builder.
T com.mojang.brigadier.builder.ArgumentBuilder< S, T >.executes | ( | final Command< S > | command | ) |
Sets the command that will be executed by the built command node.
command | the Command to execute |
T com.mojang.brigadier.builder.ArgumentBuilder< S, T >.fork | ( | final CommandNode< S > | target, |
final RedirectModifier< S > | modifier | ||
) |
Forks this command node, i.e.
it splits execution and calls the target command node multiple times with different sources.
Forking means that the target command will be invoked multiple times, once for each source in the list of sources generated by the passed RedirectModifier
.
target | the command node that will be invoked when the built command node is executed |
modifier | the redirect modifier to use to generate the command source list |
T com.mojang.brigadier.builder.ArgumentBuilder< S, T >.forward | ( | final CommandNode< S > | target, |
final RedirectModifier< S > | modifier, | ||
final boolean | fork | ||
) |
Forwards this command in some way to a given target command.
It will call the target
command node for each command source in the list the modifier
returns, but the semantics differ slightly. Please have a look at CommandDispatcher#execute(ParseResults)
for a more detailed explanation.
target | the command node that will be invoked when the built command node is executed |
modifier | the redirect modifier to use to generate the command source list |
fork | whether the command node should be forked |
Collection< CommandNode< S > > com.mojang.brigadier.builder.ArgumentBuilder< S, T >.getArguments | ( | ) |
Returns all registered child command nodes.
Command< S > com.mojang.brigadier.builder.ArgumentBuilder< S, T >.getCommand | ( | ) |
CommandNode< S > com.mojang.brigadier.builder.ArgumentBuilder< S, T >.getRedirect | ( | ) |
Returns the command node that the built command node redirects to.
RedirectModifier< S > com.mojang.brigadier.builder.ArgumentBuilder< S, T >.getRedirectModifier | ( | ) |
Returns the redirect modifier for the built command node.
Predicate< S > com.mojang.brigadier.builder.ArgumentBuilder< S, T >.getRequirement | ( | ) |
Returns the requirement each command source must meet in order to be able to use this command node.
|
abstractprotected |
Returns this argument builder.
This returns T
and is therefore suitable to allow chained calls to also call methods of the subclass it was invoked on. This is possible as this emulates a "self" type in java, which would always resolve to the type of the object you call it on.
boolean com.mojang.brigadier.builder.ArgumentBuilder< S, T >.isFork | ( | ) |
Returns whether the built command node forks.
T com.mojang.brigadier.builder.ArgumentBuilder< S, T >.redirect | ( | final CommandNode< S > | target | ) |
Redirects this command node to the target CommandNode
.
A redirected node will appear in usage listings, but will otherwise behave just like an alias to the command node it points to.
This method sets isFork()
to false and applies no RedirectModifier
.
target | the command node that will be invoked when the built command node is executed |
T com.mojang.brigadier.builder.ArgumentBuilder< S, T >.redirect | ( | final CommandNode< S > | target, |
final SingleRedirectModifier< S > | modifier | ||
) |
Redirects this command node to the target CommandNode
.
A redirected node will appear in usage listings, but will otherwise behave just like an alias to the command node it points to.
This method sets isFork()
to false and applies the given SingleRedirectModifier
.
target | the command node that will be invoked when the built command node is executed |
modifier | the redirect modifier to apply |
T com.mojang.brigadier.builder.ArgumentBuilder< S, T >.requires | ( | final Predicate< S > | requirement | ) |
Sets the predicate that must be true for a command source in order to be able to use the built command node or its children.
The default requirement, if you set none, is always true.
requirement | the requirement each command source needs to fulfill in order to be able to use the built command node or its children |
T com.mojang.brigadier.builder.ArgumentBuilder< S, T >.then | ( | final ArgumentBuilder< S, ?> | argument | ) |
Builds the given ArgumentBuilder and adds the result as new child node.
argument | the ArgumentBuilder to add |
IllegalStateException | if getRedirect() is set (i.e. not null) |
T com.mojang.brigadier.builder.ArgumentBuilder< S, T >.then | ( | final CommandNode< S > | argument | ) |
Adds the given command node as a child.
argument | the command node to add |
IllegalStateException | if getRedirect() is set (i.e. not null) |