Skip to content

Additional command properties

Marten edited this page Dec 26, 2021 · 2 revisions

Aliases

Each SimpleCommand can have an unlimited amount of aliases. These are displayed in the tab completion by default.

public class ExampleCommand extends SimpleCommand {
    public SubAliases(boolean add) {
        super("aliases", false);

        // Add an alias
        addAlias("someAlias");
    }
}

Hidden commands

Sometimes you need a command for internal usage, but you don't want to show it in the help or in tab completions. The library features a method to set a command as hidden. This means it will be never used for tab completions or be shown in the help.

public class ExampleCommand extends SimpleCommand {
    public SubAliases(boolean add) {
        super("aliases", false);
       
        // Make the command hidden
        setHidden(true);
    }
}

If simply setting the command hidden is not enough and you need more control, you can overwrite the isHidden() and isHidden(CommandSender) methods in the SimpleCommand class.

Clone this wiki locally