Package com.velocitypowered.api.command
Class BrigadierCommand
java.lang.Object
com.velocitypowered.api.command.BrigadierCommand
- All Implemented Interfaces:
Command
A command that uses Brigadier for parsing the command and
providing suggestions to the client.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The return code used by aCommand
to indicate the command execution should be forwarded to the backend server. -
Constructor Summary
ConstructorDescriptionBrigadierCommand
(@NotNull com.mojang.brigadier.builder.LiteralArgumentBuilder<CommandSource> builder) Constructs aBrigadierCommand
from the node returned by the given builder.BrigadierCommand
(@NotNull com.mojang.brigadier.tree.LiteralCommandNode<CommandSource> node) Constructs aBrigadierCommand
from the given command node. -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.brigadier.tree.LiteralCommandNode<CommandSource>
getNode()
Returns the literal node for this command.static com.mojang.brigadier.builder.LiteralArgumentBuilder<CommandSource>
literalArgumentBuilder
(@NotNull String name) Creates a new LiteralArgumentBuilder of the required name.static <T> com.mojang.brigadier.builder.RequiredArgumentBuilder<CommandSource,
T> requiredArgumentBuilder
(@NotNull String name, @NotNull com.mojang.brigadier.arguments.ArgumentType<T> argumentType) Creates a new RequiredArgumentBuilder of the required name and type.
-
Field Details
-
FORWARD
public static final int FORWARDThe return code used by aCommand
to indicate the command execution should be forwarded to the backend server.- See Also:
-
-
Constructor Details
-
BrigadierCommand
public BrigadierCommand(@NotNull @NotNull com.mojang.brigadier.builder.LiteralArgumentBuilder<CommandSource> builder) Constructs aBrigadierCommand
from the node returned by the given builder.- Parameters:
builder
- theLiteralCommandNode
builder
-
BrigadierCommand
public BrigadierCommand(@NotNull @NotNull com.mojang.brigadier.tree.LiteralCommandNode<CommandSource> node) Constructs aBrigadierCommand
from the given command node.- Parameters:
node
- the command node
-
-
Method Details
-
getNode
Returns the literal node for this command.- Returns:
- the command node
-
literalArgumentBuilder
public static com.mojang.brigadier.builder.LiteralArgumentBuilder<CommandSource> literalArgumentBuilder(@NotNull @NotNull String name) Creates a new LiteralArgumentBuilder of the required name.- Parameters:
name
- the literal name.- Returns:
- a new LiteralArgumentBuilder.
-
requiredArgumentBuilder
public static <T> com.mojang.brigadier.builder.RequiredArgumentBuilder<CommandSource,T> requiredArgumentBuilder(@NotNull @NotNull String name, @NotNull @NotNull com.mojang.brigadier.arguments.ArgumentType<T> argumentType) Creates a new RequiredArgumentBuilder of the required name and type.- Type Parameters:
T
- the ArgumentType required type- Parameters:
name
- the argument nameargumentType
- the argument type required- Returns:
- a new RequiredArgumentBuilder
-