Interface BasicCommand
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Implementing this interface allows for easily creating "Bukkit-style"
String[] args commands.
The implementation handles converting the command to a representation compatible with Brigadier on registration, usually in the form of /commandlabel <greedy_string>.-
Method Summary
Modifier and TypeMethodDescriptiondefault booleancanUse(CommandSender sender) Checks whether a command sender can receive and run the root command.voidexecute(CommandSourceStack commandSourceStack, String[] args) Executes the command with the givenCommandSourceStackand arguments.Returns the permission for the root command used incanUse(CommandSender)by default.default Collection<String> suggest(CommandSourceStack commandSourceStack, String[] args) Suggests possible completions for the given commandCommandSourceStackand arguments.
-
Method Details
-
execute
Executes the command with the givenCommandSourceStackand arguments.- Parameters:
commandSourceStack- the commandSourceStack of the commandargs- the arguments of the command ignoring repeated spaces
-
suggest
@OverrideOnly default Collection<String> suggest(CommandSourceStack commandSourceStack, String[] args) Suggests possible completions for the given commandCommandSourceStackand arguments.- Parameters:
commandSourceStack- the commandSourceStack of the commandargs- the arguments of the command including repeated spaces- Returns:
- a collection of suggestions
-
canUse
Checks whether a command sender can receive and run the root command.- Parameters:
sender- the command sender trying to execute the command- Returns:
- whether the command sender fulfills the root command requirement
- See Also:
-
permission
Returns the permission for the root command used incanUse(CommandSender)by default.- Returns:
- the permission for the root command used in
canUse(CommandSender)
-