BukkitCommand, FormattedCommandAlias, MultipleCommandAlias, PluginCommandpublic abstract class Command extends Object
| Modifier and Type | Field | Description | 
|---|---|---|
| protected String | description | |
| CustomTimingsHandler | timings | |
| protected String | usageMessage | 
| Modifier | Constructor | Description | 
|---|---|---|
| protected  | Command(@NotNull String name) | |
| protected  | Command(@NotNull String name,
       @NotNull String description,
       @NotNull String usageMessage,
       @NotNull List<String> aliases) | 
| Modifier and Type | Method | Description | 
|---|---|---|
| static void | broadcastCommandMessage(@NotNull CommandSender source,
                       @NotNull String message) | |
| static void | broadcastCommandMessage(@NotNull CommandSender source,
                       @NotNull String message,
                       boolean sendToSource) | |
| abstract boolean | execute(@NotNull CommandSender sender,
       @NotNull String commandLabel,
       @NotNull String[] args) | Executes the command, returning its success | 
| @NotNull List<String> | getAliases() | Returns a list of active aliases of this command | 
| @NotNull String | getDescription() | Gets a brief description of this command | 
| @NotNull String | getLabel() | Returns the label for this command | 
| @NotNull String | getName() | Returns the name of this command | 
| @Nullable String | getPermission() | Gets the permission required by users to be able to perform this
 command | 
| @Nullable String | getPermissionMessage() | Returns a message to be displayed on a failed permission check for this
 command | 
| @NotNull String | getUsage() | Gets an example usage of this command | 
| boolean | isRegistered() | Returns the current registered state of this command | 
| boolean | register(@NotNull CommandMap commandMap) | Registers this command to a CommandMap. | 
| @NotNull Command | setAliases(@NotNull List<String> aliases) | Sets the list of aliases to request on registration for this command. | 
| @NotNull Command | setDescription(@NotNull String description) | Sets a brief description of this command. | 
| boolean | setLabel(@NotNull String name) | Sets the label of this command. | 
| boolean | setName(@NotNull String name) | Sets the name of this command. | 
| void | setPermission(@Nullable String permission) | Sets the permission required by users to be able to perform this
 command | 
| @NotNull Command | setPermissionMessage(@Nullable String permissionMessage) | Sets the message sent when a permission check fails | 
| @NotNull Command | setUsage(@NotNull String usage) | Sets the example usage of this command | 
| @NotNull List<String> | tabComplete(@NotNull CommandSender sender,
           @NotNull String alias,
           @NotNull String[] args) | Executed on tab completion for this command, returning a list of
 options the player can tab through. | 
| @NotNull List<String> | tabComplete(@NotNull CommandSender sender,
           @NotNull String alias,
           @NotNull String[] args,
           @Nullable Location location) | Executed on tab completion for this command, returning a list of
 options the player can tab through. | 
| boolean | testPermission(@NotNull CommandSender target) | Tests the given  CommandSenderto see if they can perform this
 command. | 
| boolean | testPermissionSilent(@NotNull CommandSender target) | Tests the given  CommandSenderto see if they can perform this
 command. | 
| String | toString() | |
| boolean | unregister(@NotNull CommandMap commandMap) | Unregisters this command from the passed CommandMap applying any
 outstanding changes | 
protected String description
protected String usageMessage
public CustomTimingsHandler timings
protected Command(@NotNull
                  @NotNull String name)
public abstract boolean execute(@NotNull
                                @NotNull CommandSender sender,
                                @NotNull
                                @NotNull String commandLabel,
                                @NotNull
                                @NotNull String[] args)
sender - Source object which is executing this commandcommandLabel - The alias of the command usedargs - All arguments passed to the command, split via ' '@NotNull public @NotNull List<String> tabComplete(@NotNull @NotNull CommandSender sender, @NotNull @NotNull String alias, @NotNull @NotNull String[] args) throws IllegalArgumentException
sender - Source object which is executing this commandalias - the alias being usedargs - All arguments passed to the command, split via ' 'IllegalArgumentException - if sender, alias, or args is null@NotNull public @NotNull List<String> tabComplete(@NotNull @NotNull CommandSender sender, @NotNull @NotNull String alias, @NotNull @NotNull String[] args, @Nullable @Nullable Location location) throws IllegalArgumentException
sender - Source object which is executing this commandalias - the alias being usedargs - All arguments passed to the command, split via ' 'location - The position looked at by the sender, or null if noneIllegalArgumentException - if sender, alias, or args is null@NotNull public @NotNull String getName()
public boolean setName(@NotNull
                       @NotNull String name)
May only be used before registering the command. Will return true if the new name is set, and false if the command has already been registered.
name - New command name@Nullable public @Nullable String getPermission()
public void setPermission(@Nullable
                          @Nullable String permission)
permission - Permission name or nullpublic boolean testPermission(@NotNull
                              @NotNull CommandSender target)
CommandSender to see if they can perform this
 command.
 If they do not have permission, they will be informed that they cannot do this.
target - User to testpublic boolean testPermissionSilent(@NotNull
                                    @NotNull CommandSender target)
CommandSender to see if they can perform this
 command.
 No error is sent to the sender.
target - User to test@NotNull public @NotNull String getLabel()
public boolean setLabel(@NotNull
                        @NotNull String name)
May only be used before registering the command. Will return true if the new name is set, and false if the command has already been registered.
name - The command's namepublic boolean register(@NotNull
                        @NotNull CommandMap commandMap)
commandMap - the CommandMap to register this command topublic boolean unregister(@NotNull
                          @NotNull CommandMap commandMap)
commandMap - the CommandMap to unregisterpublic boolean isRegistered()
@NotNull public @NotNull List<String> getAliases()
@Nullable public @Nullable String getPermissionMessage()
@NotNull public @NotNull String getDescription()
@NotNull public @NotNull String getUsage()
@NotNull public @NotNull Command setAliases(@NotNull @NotNull List<String> aliases)
PluginDescriptionFile.getCommands() (under the
 `aliases' node) is equivalent to this method.aliases - aliases to register to this command@NotNull public @NotNull Command setDescription(@NotNull @NotNull String description)
PluginDescriptionFile.getCommands() (under the
 `description' node) is equivalent to this method.description - new command description@NotNull public @NotNull Command setPermissionMessage(@Nullable @Nullable String permissionMessage)
permissionMessage - new permission message, null to indicate
     default message, or an empty string to indicate no message@NotNull public @NotNull Command setUsage(@NotNull @NotNull String usage)
usage - new example usagepublic static void broadcastCommandMessage(@NotNull
                                           @NotNull CommandSender source,
                                           @NotNull
                                           @NotNull String message)
public static void broadcastCommandMessage(@NotNull
                                           @NotNull CommandSender source,
                                           @NotNull
                                           @NotNull String message,
                                           boolean sendToSource)
Copyright © 2020. All rights reserved.