Class ApiCommand

java.lang.Object
org.bukkit.command.Command
com.burchard36.api.command.ApiCommand
All Implemented Interfaces:
org.bukkit.command.TabCompleter

public class ApiCommand extends org.bukkit.command.Command implements org.bukkit.command.TabCompleter
The class you want to use when registering commands. You are meant to extend this class
Since:
2.1.5
Author:
Dalton Burchard
  • Field Details

  • Constructor Details

    • ApiCommand

      public ApiCommand()
  • Method Details

    • execute

      public boolean execute(@Nonnull org.bukkit.command.CommandSender sender, @Nonnull String commandLabel, @Nonnull String[] args)
      Specified by:
      execute in class org.bukkit.command.Command
    • onPlayerSender

      public ApiCommand onPlayerSender(OnPlayerSender sender)
      Sets the function to run when a Player sends a command
      Parameters:
      sender - A OnPlayerSender lambda interface
      Returns:
      instance of this ApiCommand
      Since:
      2.1.5
    • onConsoleSender

      public ApiCommand onConsoleSender(OnConsoleSender sender)
      Sets the function to run when a ConsoleCommandSender sends a command
      Parameters:
      sender - A OnConsoleSender lambda interface
      Returns:
      instance of this ApiCommand
      Since:
      2.1.5
    • onTabComplete

      public ApiCommand onTabComplete(OnTabComplete onComplete)
      Executes a TabCompleter for this command, only usage if you set a OnPlayerSender interface using onPlayerSender
      Parameters:
      onComplete - A OnTabComplete functional interface lambda
      Returns:
      instance of this ApiCommand
      Since:
      2.1.5
    • setCommandName

      public ApiCommand setCommandName(String newName)
      Sets the command name when executing eg /
      Parameters:
      newName - A String without spaces
      Returns:
      instance of this ApiCommand
      Since:
      2.1.5
    • setCommandDescription

      public ApiCommand setCommandDescription(String newDesc)
      Sets the description of this command
      Parameters:
      newDesc - Any String
      Returns:
      instance of this ApiCommand
      Since:
      2.1.5
    • setCommandUsage

      public ApiCommand setCommandUsage(String usage)
      Sets the Command usage message for this command
      Parameters:
      usage - String to set usage message to
      Returns:
      instance of this ApiCommand
      Since:
      2.1.5
    • setCommandAliases

      public ApiCommand setCommandAliases(String... aliases)
      Sets the aliases of this command
      Parameters:
      aliases - Varargs of String's, no strings with spaces
      Returns:
      instance of this ApiCommand
      Since:
      2.1.5
    • onTabComplete

      public List<String> onTabComplete(@Nonnull org.bukkit.command.CommandSender sender, @Nonnull org.bukkit.command.Command command, @Nonnull String label, @Nonnull String[] args)
      Specified by:
      onTabComplete in interface org.bukkit.command.TabCompleter