Interface Command


public interface Command
Represents an executable command.
  • Method Details

    • getName

      @Nonnull String getName()
      Get the primary name of this command.
      Returns:
      the command name
    • getPermission

      default String getPermission()
      Get the permission required to execute this command.
      Returns:
      the permission, or null if no permission is required
    • getUsage

      default String getUsage()
      Get the usage string for this command.
      Returns:
      the usage string
    • getDescription

      default String getDescription()
      Get the description of this command.
      Returns:
      the description
    • execute

      @Nonnull CommandResult execute(@Nonnull CommandSource source, @Nonnull String[] args)
      Execute this command.
      Parameters:
      source - the command source
      args - the arguments passed to the command
      Returns:
      the result of the command
    • suggest

      @Nonnull default List<String> suggest(@Nonnull CommandSource source, @Nonnull String[] args)
      Get tab completions for this command.
      Parameters:
      source - the command source
      args - the current arguments
      Returns:
      a list of possible completions
    • hasPermission

      default boolean hasPermission(@Nonnull CommandSource source)
      Check if the source has permission to execute this command.
      Parameters:
      source - the command source
      Returns:
      true if the source can execute this command