public final class LiteralNode extends Object
LiteralNode node = LiteralNode.node().argument(LiteralArgument.literal("literal").then(LiteralArgument.literal("other")));
Modifier and Type | Method and Description |
---|---|
@NotNull LiteralNode |
argument(@NotNull Argument argument)
Adds argument to the base sub commands.
|
@NotNull String |
buildUsage()
Builds the argument usage.
|
@NotNull String |
buildUsage(@Nullable String alias)
Builds full command usage for the alias specified
|
@NotNull List<String> |
completeToStringList(@NotNull String[] args)
Returns a unmodifiable string list, which converts brigadier's suggestions to string list
suggestions based on the arguments specified.
|
Optional<Argument> |
getArgumentByName(@NotNull String name)
Returns
Optional value of the argument with the name specified. |
@NotNull List<Argument> |
getArguments()
Returns unmodifiable copy of the base
Arguments with their children. |
@NotNull List<Argument> |
getArgumentsByIndex(int index)
Returns unmodifiable list of all the arguments, held by this index.
|
@NotNull LiteralNode |
markShouldExecuteCommand() |
static LiteralNode |
node()
Creates a new
LiteralNode |
boolean |
shouldExecuteCommand()
Returns whether the node should call the base command's execute method if the command was
called with no arguments.
|
String |
toString() |
public static LiteralNode node()
LiteralNode
@NotNull public @NotNull LiteralNode argument(@NotNull @NotNull Argument argument)
argument
- argumentArgument
@NotNull public @NotNull LiteralNode markShouldExecuteCommand()
shouldExecuteCommand()
@NotNull public @NotNull List<Argument> getArguments()
Arguments
with their children.public boolean shouldExecuteCommand()
true
if should execute command, false
otherwise.public Optional<Argument> getArgumentByName(@NotNull @NotNull String name)
Optional
value of the argument with the name specified.name
- name@NotNull public @NotNull List<Argument> getArgumentsByIndex(int index)
index
- the index for which you need the arguments@NotNull public @NotNull String buildUsage()
@NotNull public @NotNull String buildUsage(@Nullable @Nullable String alias)
alias
- command alias for which you want full command usage@NotNull public @NotNull List<String> completeToStringList(@NotNull @NotNull String[] args)
args
- args for which you need string list completionCopyright © 2020. All rights reserved.