PolarDocs Client Area

Subcommand Class

Introduction#

The Subcommand abstract class is the base for custom subcommands registered through the Subcommands interface.

Subclasses implement execute and onTabComplete.

Constructors#

Subcommand(String label, boolean hidden, String permission)#

java
public Subcommand(String label, boolean hidden, String permission);

Parameters:

  • label - The name of the subcommand, used as /polar <label>.
  • hidden - true to hide the subcommand from the /polar help listing.
  • permission - The permission required to run the subcommand, or null for none.

Subcommand(String label)#

java
public Subcommand(String label);

Description:

Creates a visible subcommand with no permission requirement.

Parameters:

  • label - The name of the subcommand.

Abstract Methods#

execute#

java
public abstract void execute(User sender, String label, String[] args);

Description:

Called when the subcommand is run.

Parameters:

  • sender - The User who ran the command.
  • label - The label the command was invoked with.
  • args - The arguments following the label.

onTabComplete#

java
public abstract List<String> onTabComplete(User sender, String[] args);

Description:

Called to provide tab completion suggestions.

Parameters:

  • sender - The User requesting completions.
  • args - The arguments typed so far.

Returns:

A list of suggestions. May be empty.

Getters#

getLabel#

java
public String getLabel();

Returns:

The label of the subcommand.

isHidden#

java
public boolean isHidden();

Returns:

true if the subcommand is hidden from the help listing.

getPermission#

java
public String getPermission();

Returns:

The required permission, or null if none is required.