Spigot Command API 1.0-SNAPSHOT

A lightweight, easy to use, extremely useful Spigot Command API

  1. Gleemingknight
    Tested Minecraft Versions:
    • 1.7
    • 1.8
    • 1.9
    • 1.10
    • 1.11
    • 1.12
    • 1.13
    • 1.14
    • 1.15
    • 1.16
    Source Code:
    http://github.com/GleemingKnight/spigot-command-api
    This is a Spigot Command API made by me, it's extremely useful & easy to use.

    How to use
    Copy and paste the code at the bottom of the page, into a new class called something like 'ACommand'.

    In your onEnable() initialize each command by doing
    Code (Java):
    new ExampleCommand();
    After initializing each command here, just create the classes and make them extend ACommand.

    Here's an example command.

    Code (Java):
    public class ExampleCommand extends ACommand {
       // You can now register how ever many subcommands and regular commands you'd like
     
       // This is a basic command
       // The syntax for this would just be /example
       @Command(name = "example")
       public void exampleCommand(Arguments arguments) {
           arguments.getPlayer().sendMessage(ChatColor.GREEN + "Hello!");
       }

       // This is an example of a command with an option for
       // the player to fill in the command argument.
       // The syntax for this command would be /example teleport <player-name>
       @Command(name = "example.teleport.<player>", permission = "command.teleport", aliases = new String[] { tp }, playersOnly = true)
       public void teleportCommand(Arguments arguments) {
           // Now we can get the first argument as there
           // is only one unknown argument in this command.
         
           arguments.getPlayer().teleport(Bukkit.getPlayer(arguments.getArguments().get(0)));
       }

       // You can also have help pages for if the base command is found
       // although a subcommand is not found for it.
       @Help(command = "example")
       public void helpMessage(CommandSender sender) {
           sender.sendMessage("You can use /example teleport <player> or /example");  
       }  
    }
    ArshQuick likes this.