Interface CommandCondition
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Used to know if the
CommandSender
is allowed to run the command or a specific syntax.-
Method Summary
Modifier and TypeMethodDescriptionboolean
canUse
(@NotNull CommandSender sender, @Nullable String commandString) Called when the sender permission needs to be checked.
-
Method Details
-
canUse
Called when the sender permission needs to be checked.The first time will be during player connection in order to know if the command/syntax should be displayed as tab-completion suggestion,
commandString
will be null in this case. (It is also possible for the command string to be null if a new command packet is built)Otherwise,
commandString
will never be null but will instead be the raw command string given by the sender. You should in this case warn the sender (eg by sending a message) if the condition is unsuccessful.- Parameters:
sender
- the sender of the commandcommandString
- the raw command string, null if this is an access request- Returns:
- true if the sender has the right to use the command, false otherwise
-