java.lang.Object
net.minestom.server.command.builder.Command
Direct Known Subclasses:
SimpleCommand

public class Command extends Object
Represents a command which has suggestion/auto-completion.

The command works using a list of valid syntaxes. For instance we could build the command "/health set Notch 50" into multiple argument types "/health [set/add/remove] [username] [integer]"

All the default argument types can be found in ArgumentType and the syntax be created/registered using addSyntax(CommandExecutor, Argument[]).

If the command is executed with an incorrect syntax or without any argument, the default CommandExecutor will be called, you can set it using setDefaultExecutor(CommandExecutor).

Before any syntax to be successfully executed the CommandSender needs to validated the CommandCondition sets with setCondition(CommandCondition) (ignored if null).

Some Argument could also require additional condition (eg: a number which need to be between 2 values), in this case, if the whole syntax is correct but not the argument condition, you can listen to its error code using setArgumentCallback(ArgumentCallback, Argument) or Argument.setCallback(ArgumentCallback).