Example: Command

Root command with a simple subcommand and permission

MyPlugin + Executor
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;
import org.bukkit.plugin.java.JavaPlugin;

public class MyPlugin extends JavaPlugin {
  @Override
  public void onEnable() {
    new CommandRegistry(this).registerCommand("example", new ExampleCommand());
  }
}

class ExampleCommand extends LongCommandExecutor {
  public ExampleCommand() {
    addSubCommand(new SubCommand() {
      @Override public void onExecute(CommandSender sender, String[] args) {
        sender.sendMessage("Hey!");
      }
      @Override public java.util.List<String> onTabComplete(CommandSender s, String[] a) {
        return java.util.List.of("hello");
      }
    }, new String[]{"hello", "hi"}, new Permission("example.use"));
  }
}
plugin.yml
commands:
  example:
    description: Example root command
    permission: example.use
    permission-message: "No permission"