All Implemented Interfaces:
org.bukkit.command.CommandExecutor, org.bukkit.command.TabCompleter

public abstract class CyberCommand extends BaseCommand implements org.bukkit.command.CommandExecutor, org.bukkit.command.TabCompleter
Used to easily create a command that can then be registered to the server.
  • Constructor Details

    • CyberCommand

      public CyberCommand(String name, String permission, String permissionMsg, String usage)
      Creates a new CyberCommand with the provided arguments.

      Note: this is where you should call the register(boolean) method.

      Parameters:
      name - The name of the command
      permission - The permission to use the command (null for no permission)
      permissionMsg - The message to send to the player if they do not have the permission
      usage - The usage of the command
    • CyberCommand

      public CyberCommand(String name, String permission, String usage)
      Creates a new CyberCommand with the provided arguments. The permission message is set to the default permission message provided by CyberCommandUtils.getDefaultPermissionMsg().

      Note: this is where you should call the register(boolean) method.

      Parameters:
      name - The name of the command
      permission - The permission to use the command (null for no permission)
      usage - The usage of the command
    • CyberCommand

      public CyberCommand(String name, String usage)
      Creates a new CyberCommand with the provided arguments. The permission message is set to the default permission message provided by CyberCommandUtils.getDefaultPermissionMsg(). The permission is assumed to be null, meaning that no permission is needed to execute this command.

      Note: this is where you should call the register(boolean) method.

      Parameters:
      name - The name of the command
      usage - The usage of the command
  • Method Details

    • onTabComplete

      public final List<String> onTabComplete(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args)
      This should be ignored by most developers
      Specified by:
      onTabComplete in interface org.bukkit.command.TabCompleter
    • tabComplete

      public abstract List<String> tabComplete(SentCommand command)
      The tabComplete method is called when the player presses tab while typing a command.

      Returning an empty list will do the following:
       - If the argument the command sender is currently typing has been set (via BaseCommand.setArgType(int, ArgType)) to either ArgType.ONLINE_PLAYER or ArgType.OFFLINE_PLAYER), then a list of players will be sent to the command sender.
       - If the above yields no results, an empty list will be sent to the command sender.
      To override this behavior, return a list containing one string that is empty, and that will be returned instead.

      Parameters:
      command - The SentCommand of the command that is being typed
      Returns:
      A list of strings to return to the command sender
    • onCommand

      public final boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args)
      This should be ignored by most developers
      Specified by:
      onCommand in interface org.bukkit.command.CommandExecutor
    • execute

      public abstract boolean execute(SentCommand command)
      The execute method is called when the player executes a command. All information about the command, who executed it, the arguments, etc. are provided in the SentCommand parameter

      The value returned by this method will be returned to the CommandExecutor.onCommand(CommandSender, Command, String, String[]) method.

      Parameters:
      command - The SentCommand of the command that was executed
      Returns:
      What to return to the CommandExecutor.onCommand(CommandSender, Command, String, String[]) method
      See Also:
      • CommandExecutor.onCommand(CommandSender, Command, String, String[])
    • register

      public final void register(boolean includeTabComplete)
      Required to be executed for the command to work properly
      Parameters:
      includeTabComplete - if the command should be tab completable