[Util] Simple Command Library

Discussion in 'Resources' started by MP5K, May 3, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    MP5K

    To make it easier to create commands i have written a little (1 File) command library.
    Maybe it's useful for someone. If you find it useful i can add some additionally futures
    View the File at Github

    the way you create a Command is quiet easy:
    1. create a Class with extends <ICommand>
    2. override one of the Command Methods (onPlayerCommand, onConsoleCommand , onCommand)
    3. add the @CommandHandler annotation to the Class with the Command Specific Informations
    (like: name, Permission, Description, Usage...)
    4. call the register() method
    5. Done.

    Example:
    PHP:
    //Test Command
    package de.mineorea.lib.commands;
     
    import java.util.List;
    import org.bukkit.entity.Player;
    import de.mineorea.lib.commands.ICommand.CommandManager;
     
    @
    CommandManager(description "Prints <true>"name "true")
    public final class 
    TestCommand extends ICommand {
     
      public 
    TestCommand(){
            
    this.register();
            
    this.setPermission("my.plugin.permission"); //needs to be called after "register()"
            
    this.setPermissionsMessage(null);
        }
       
        @
    Override
        
    public Boolean onPlayerCommand(Player senderString CommandString[] args, List<ISubCommandsubcommandsint lenght) {
            
    sender.sendMessage("true");
            return 
    true;
        }
    }
    btw. sorry for the crappy English in the JavaDocs
     
  2. Offline

    ZeusAllMighty11

    This is awesome
     
  3. Offline

    skipperguy12

    I personally like Sk89's command framework better, just an opinion.
     
Thread Status:
Not open for further replies.

Share This Page