Class CommandSyntax
java.lang.Object
net.minestom.server.command.builder.CommandSyntax
public class CommandSyntax
extends java.lang.Object
Represents a syntax in
Command
which is initialized with Command.addSyntax(CommandExecutor, Argument[])
.-
Constructor Summary
Constructors Modifier Constructor Description protected
CommandSyntax(CommandCondition commandCondition, CommandExecutor commandExecutor, Argument<?>... args)
-
Method Summary
Modifier and Type Method Description Argument<?>[]
getArguments()
Gets all the requiredArgument
for this syntax.CommandCondition
getCommandCondition()
Gets the condition to use this syntax.CommandExecutor
getExecutor()
Gets theCommandExecutor
of this syntax, executed once the syntax is properly written.void
setCommandCondition(CommandCondition commandCondition)
Changes the command condition of this syntax.void
setExecutor(CommandExecutor executor)
Changes theCommandExecutor
of this syntax.
-
Constructor Details
-
CommandSyntax
protected CommandSyntax(@Nullable CommandCondition commandCondition, @NotNull CommandExecutor commandExecutor, @NotNull Argument<?>... args)
-
-
Method Details
-
getCommandCondition
Gets the condition to use this syntax.- Returns:
- this command condition, null if none
-
setCommandCondition
Changes the command condition of this syntax.Be aware that changing the command condition will not automatically update players auto-completion. You can create a new packet containing the changes with
CommandManager.createDeclareCommandsPacket(Player)
.- Parameters:
commandCondition
- the new command condition, null to remove it
-
getExecutor
Gets theCommandExecutor
of this syntax, executed once the syntax is properly written.- Returns:
- the executor of this syntax
-
setExecutor
Changes theCommandExecutor
of this syntax.- Parameters:
executor
- the new executor
-
getArguments
Gets all the requiredArgument
for this syntax.- Returns:
- the required arguments
-