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 boolean
canUse
(CommandSender sender) Checks whether a command sender can receive and run the root command.void
execute
(CommandSourceStack commandSourceStack, String[] args) Executes the command with the givenCommandSourceStack
and 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 commandCommandSourceStack
and arguments.
-
Method Details
-
execute
Executes the command with the givenCommandSourceStack
and 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 commandCommandSourceStack
and 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)
-