Skip to content
This repository has been archived by the owner on Jan 10, 2021. It is now read-only.
Gilberto Garcia edited this page Apr 28, 2020 · 3 revisions

This page will only explain the basic usage of the api, more detailed usage for them will be explained on the other wiki pages.

Concepts

The command manager is composed of 2 parts, the builder api and the parametric api.

The parametric api is just an extension to the builder api, so actually the parametric api are just converters to the builder api. The concepts needed to interact with the api are the next:

  • CommandPart Like the name says, a part of the command parameters, like an argument, a flag, or an injected value
  • CommandAction The action to execute when the command is called
  • Command Builder A class that can create using the specified data a new command instance
  • CommandData Contains the data of the command like the name, the aliases and the description
  • Command A class that has the execution data of the command, CommandParts, the permission to check, and the CommandAction
  • CommandManager Stores the registered commands and has methods to dispatch a command based on the arguments provided

Usage

Common

There's a common thing that you need to do for the 2 types of commands. Initialize a CommandManager instance! Here's how you do it

CommandManager manager = new SimpleCommandManager(); // There are more constructors for this but, they're for other things

This automatically creates all the needed objects and gives you a ready to work instance, but, for more complex scenarios like using the wrapper for bukkit, or registering ParameterProvider's you need to create the objects manually, like this.

Authorizer authorizer = new BukkitAuthorizer();
ParameterProviderRegistry providerRegistry = ParameterProviderRegistry.createRegistry();
Messager messager = new BukkitMessager();

CommandManager commandManager = new SimpleCommandManager(authorizer, messager, providerRegistry);

Builder Api

Here!

Annotated Command API

Here!