Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.
/ ample Public archive

A basic annotation-based command system for Spigot.

License

Notifications You must be signed in to change notification settings

haq/ample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

license

ample

A basic annotation based command system for Spigot. You do no need to declare the commands in plugin.yml as it will register the commands for you.

Todo

  • Subcommands

Usage

public class TestPlugin extends JavaPlugin {

    @Override
    public void onEnable() {
        new Ample(this) // passing in java plugin, so it can get plugin name
                .register(this); // the objects that contain the command annotated methods
    }

    //every command method needs this annotation
    @Command(
            value = "Test",
            description = "Test command",
            usage = "test <int> <double> <string>",
            alias = {"tst", "t"}
    )
    @PlayerOnly // tag a method with this annotation if you want that command to be run by a player only
    @Permission("example.perm") // tag a method with this if the command has a permission requirement
    public void test(CommandSender commandSender, int arg1, double arg2, String arg3) {
        System.out.println("TEST COMMAND!");
    }
}

Download

<repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
</repository>
<dependency>
    <groupId>com.github.haq</groupId>
    <artifactId>ample</artifactId>
    <version>VERSION</version>
</dependency>