LongCommandExecutor
Base for root commands with subcommands, permissions and tab-complete
Usage
import io.github.chi2l3s.nextlib.api.command.CommandRegistry;
import io.github.chi2l3s.nextlib.api.command.LongCommandExecutor;
import io.github.chi2l3s.nextlib.api.command.SubCommand;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.Permission;
public class ExampleCommand extends LongCommandExecutor {
public ExampleCommand() {
addSubCommand(new SubCommand() {
@Override public void onExecute(CommandSender sender, String[] args) {
sender.sendMessage("Sub executed");
}
@Override public java.util.List<String> onTabComplete(CommandSender s, String[] a) {
return java.util.List.of("sub");
}
}, new String[]{"sub", "s"}, new Permission("example.use"));
}
}
// Registration (plugin.yml must declare command 'example')
new CommandRegistry(this).registerCommand("example", new ExampleCommand());Key Methods
- addSubCommand(SubCommand, String[] aliases, Permission)
- onCommand(...) — routes to subcommand by first arg
- onTabComplete(...) — suggests first aliases then delegates