Sueta

Spigot Command API

1.0-SNAPSHOT

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

·Plugin

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

new ExampleCommand();

After initializing each command here, just create the classes and make them extend ACommand.

Here's an example command.

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");  
   }  
}

Similar projects

Plugin →