Skip to content

thelipe7/command-lib

Repository files navigation

command-lib icon

command-lib

Annotation-driven commands for Paper plugins.

Runtime registration, typed arguments, subcommands, permissions, and async tab completion without large plugin.yml command sections.

Last commit GitHub issues GitHub stars License

Documentation | Suport | Contributing | License


Overview

command-lib is a lightweight command framework for Paper plugins built around annotations and runtime registration.

It keeps command code direct while covering the repetitive parts that usually spread across plugin projects:

  • command registration without large plugin.yml command sections
  • typed argument parsing for common Bukkit and Paper types
  • subcommands, default handlers, and unknown handlers
  • permission handling at class and method level
  • async tab completion support on Paper
  • custom argument resolvers and custom tab completers

Requirements

Other Bukkit-compatible servers may work, but the current repository targets and documents Paper 1.20+.

Installation

Note

Replace TAG with a Git tag, release version, or commit hash from this repository.

Gradle (Kotlin DSL)
repositories {
    mavenCentral()
    maven("https://jitpack.io")
}

dependencies {
    implementation("com.github.thelipe7:command-lib:TAG")
}
Gradle (Groovy DSL)
repositories {
    mavenCentral()
    maven { url = 'https://jitpack.io' }
}

dependencies {
    implementation 'com.github.thelipe7:command-lib:TAG'
}
Maven
<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.github.thelipe7</groupId>
        <artifactId>command-lib</artifactId>
        <version>TAG</version>
    </dependency>
</dependencies>

Quick Start

Create a manager in your plugin:

public final class ExamplePlugin extends JavaPlugin {

    @Override
    public void onEnable() {
        CommandManager manager = new CommandManager(this, true);
        manager.registerCommand(new WarpCommand());
    }

}

Then define a command class:

@Command({"warp", "warps"})
@Permission("example.warp")
public final class WarpCommand extends CustomCommand {

    @Default
    public void defaultCommand(CommandSender sender) {
        sender.sendMessage("Use /warp teleport <player>");
    }

    @SubCommand("teleport")
    @Permission("example.warp.teleport")
    @TabComplete("@players")
    public void teleport(CommandSender sender, @Name("player") Player target) {
        sender.sendMessage("Teleport target: " + target.getName());
    }

    @Unknown(true)
    public void unknown(CommandSender sender) {
        sender.sendMessage("Unknown subcommand.");
    }

}

Documentation

Support

Use the issue templates for:

  • bugs and regressions
  • feature requests
  • usage questions

Contributing

See CONTRIBUTING for contribution guidelines and review expectations.

Sponsors

Thank you so much for considering helping me, I truly appreciate it!

License

This project is licensed under the Apache License 2.0.

See LICENSE for details.

About

Lightweight annotation-based command library for Paper plugins.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

 
 
 

Contributors

Languages