Polar Help

Subcommands Interface

Introduction

The Subcommands interface allows plugins to register their own subcommands under the /polar command, and to inspect or adjust the subcommands that ship with Polar.

It is accessed through PolarApi#subcommands().

Methods

registerSubcommand

void registerSubcommand(Subcommand subcommand, Plugin plugin);

Description:

Registers a custom subcommand. Once registered, it is executed as /polar <label> [args...].

Parameters:

  • subcommand - The Subcommand implementation to register.

  • plugin - The Bukkit Plugin registering the subcommand.

Returns:

Nothing.

subcommands

Map<String, Subcommand> subcommands(Plugin plugin);

Description:

Gets the subcommands registered by a specific plugin.

Parameters:

  • plugin - The Bukkit Plugin that registered the subcommands.

Returns:

A map of the plugin's registered Subcommands, keyed by label.

polarSubcommands

Map<String, PolarSubcommand> polarSubcommands();

Description:

Gets the subcommands built into Polar (for example alerts, reload, help). Each entry can be relabelled, hidden or disabled through the PolarSubcommand interface.

Returns:

A map of built-in PolarSubcommands, keyed by label.

Example

api.subcommands().registerSubcommand(new Subcommand("hello", false, "myplugin.polar.hello") { @Override public void execute(User sender, String label, String[] args) { sender.bukkitPlayer().ifPresent(p -> p.sendMessage("Hello, " + sender.username() + "!")); } @Override public List<String> onTabComplete(User sender, String[] args) { return Collections.emptyList(); } }, myPlugin);