Creating Commands

Here you can view details on how to create sub commands using the Commands Plugin API.

Creating Commands

In Player Auctions you can create a sub command that will allow you to create sub commands.

Registering

You can register the commands using the CommandRegistryarrow-up-right to register your command.

Here is an example to register your command, instance is your expansions' instance.

PlayerAuctionsAPI.getInstance().getCommandRegistry().addSubCommand(instance);

Examples

Here is an example of a sub command class, this will let you be able to create sub commands.

import com.olziedev.playerauctions.api.auction.command.ACommand;
import org.bukkit.command.CommandSender;

import java.util.List;

public class ExampleCommand extends ACommand {

    public ExampleCommand() {
        super("example");
        this.executorType = ExecutorType.PLAYER_ONLY;
    }

    @Override
    public void execute(CommandSender sender, String[] arguments) {
        
    }

    @Override
    public List<String> onTabComplete(CommandSender sender, String[] arguments) {
        return super.onTabComplete(sender, arguments);
    }
}

The executor type is the type of executor that can execute the command, you can set it to PLAYER_ONLY, CONSOLE_ONLY, or null for both.

The onTabComplete method is a optional the method that will show a list of strings that will be shown to the player.

Last updated