Package jss.commandapi
Class SubCommand
- java.lang.Object
-
- jss.commandapi.SubCommand
-
public abstract class SubCommand extends Object
Represents a subcommand that can be executed within a BaseCommand.This class defines the structure, metadata and optional behavior of a subcommand, while execution flow, logging and error handling are managed by
BaseCommand.- Version:
- 0.0.8-alpha
- Author:
- jonagamerpro1234
-
-
Constructor Summary
Constructors Constructor Description SubCommand()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description List<String>aliases()Returns alternative names for this subcommand.booleanallowConsole()Determines whether this subcommand can be executed from the console.protected voiddebug(String message)Utility method for debug logging related to this subcommand.Stringdescription()Returns a short description of this subcommand.StringdisabledMessage()Message displayed when the subcommand is disabled.booleanisEnabled()Determines whether this subcommand is currently enabled.booleanisPlayerOnly()Indicates whether this subcommand can only be executed by players.abstract Stringname()Gets the primary name of the subcommand.abstract booleanonCommand(org.bukkit.command.CommandSender sender, String[] args)Executes the subcommand logic.List<String>onTabList(org.bukkit.command.CommandSender sender, String[] args)Provides tab completion suggestions for this subcommand.Stringpermission()Gets the permission required to execute the subcommand.booleanrequiresPermission()Checks whether this subcommand requires a permission to be executed.Stringusage()Returns the usage information for this subcommand.
-
-
-
Method Detail
-
name
public abstract String name()
Gets the primary name of the subcommand.- Returns:
- the name of the subcommand
- Since:
- 0.0.1-alpha
-
permission
public String permission()
Gets the permission required to execute the subcommand.- Returns:
- the permission string, or empty if none is required
- Since:
- 0.0.1-alpha
-
requiresPermission
public boolean requiresPermission()
Checks whether this subcommand requires a permission to be executed.- Returns:
- true if permission is required, false otherwise
- Since:
- 0.0.1-alpha
-
onCommand
public abstract boolean onCommand(org.bukkit.command.CommandSender sender, String[] args)Executes the subcommand logic.Any exception thrown here will be handled by
BaseCommand.- Parameters:
sender- the CommandSender executing the subcommandargs- the full command arguments- Returns:
- true if execution was successful
- Since:
- 0.0.1-alpha
-
onTabList
public List<String> onTabList(org.bukkit.command.CommandSender sender, String[] args)
Provides tab completion suggestions for this subcommand.- Parameters:
sender- the CommandSender requesting tab completionargs- the command arguments- Returns:
- a list of tab completion suggestions
- Since:
- 0.0.7-alpha
-
allowConsole
public boolean allowConsole()
Determines whether this subcommand can be executed from the console.- Returns:
- true if console execution is allowed
- Since:
- 0.0.1-alpha
-
isEnabled
public boolean isEnabled()
Determines whether this subcommand is currently enabled.- Returns:
- true if enabled
- Since:
- 0.0.1-alpha
-
disabledMessage
public String disabledMessage()
Message displayed when the subcommand is disabled.- Returns:
- the disabled message
- Since:
- 0.0.1-alpha
-
isPlayerOnly
public boolean isPlayerOnly()
Indicates whether this subcommand can only be executed by players.- Returns:
- true if player-only
- Since:
- 0.0.7-alpha
-
aliases
public List<String> aliases()
Returns alternative names for this subcommand.- Returns:
- a list of aliases
- Since:
- 0.0.7-alpha
-
usage
public String usage()
Returns the usage information for this subcommand.- Returns:
- the usage string
- Since:
- 0.0.7-alpha
-
description
public String description()
Returns a short description of this subcommand.- Returns:
- the description
- Since:
- 0.0.7-alpha
-
debug
protected void debug(String message)
Utility method for debug logging related to this subcommand.Messages will only be logged if CommandAPI debug mode is enabled.
- Parameters:
message- the debug message- Since:
- 0.0.8-alpha
-
-