T - The type of "This". It is returned every time a chaining method is called, allowing unique methods on the subclass to be called.public abstract class CommandLink<T> extends Object
CommandBuilder and a CommandNode.| Modifier and Type | Class and Description |
|---|---|
static interface |
CommandLink.Executor
A function that defines a command executor
|
static interface |
CommandLink.Requirement
A function that defines a command requirement.
|
| Modifier and Type | Field and Description |
|---|---|
protected List<CommandNode<?>> |
children |
protected CommandLink.Executor |
executor |
protected List<CommandLink.Requirement> |
requires |
| Constructor and Description |
|---|
CommandLink() |
| Modifier and Type | Method and Description |
|---|---|
T |
executes(@NotNull CommandLink.Executor executor)
Sets the executor for this command
|
@UnmodifiableView @NotNull List<CommandNode<?>> |
getChildren()
Gets all children nodes
|
CommandLink.Executor |
getExecutor()
Gets the executor
|
protected abstract T |
getThis() |
T |
requires(@NotNull CommandLink.Requirement requirement)
Requires the context in which the command is executed in to pass the
requires check |
T |
requiresBlock()
Requires the sender to be a
BlockCommandSender |
T |
requiresEntity()
Requires the sender to be an
Entity |
T |
requiresLocatable()
Requires the sender to be locatable
|
T |
requiresPlayer()
Requires the sender to be a
Player |
T |
then(@NotNull CommandNode<?> node)
Adds a new node onto this command builder
|
protected final List<CommandNode<?>> children
protected final List<CommandLink.Requirement> requires
protected CommandLink.Executor executor
public T requires(@NotNull @NotNull CommandLink.Requirement requirement)
requires checkrequirement - A function that determines if a CommandContext can run the commandpublic T requiresPlayer()
Playerrequires(Requirement)public T requiresEntity()
Entityrequires(Requirement)public T requiresBlock()
BlockCommandSenderrequires(Requirement)public T requiresLocatable()
requires(Requirement)public T then(@NotNull @NotNull CommandNode<?> node)
node - The nodepublic T executes(@NotNull @NotNull CommandLink.Executor executor)
executor - The executor@NotNull public @UnmodifiableView @NotNull List<CommandNode<?>> getChildren()
public CommandLink.Executor getExecutor()
@NotNull protected abstract T getThis()
Copyright © 2024. All rights reserved.