Giter Site home page Giter Site logo

bcm's Introduction

BCM (BetterCommandManager)

I created this command manager one night after I needed a Better Command Manager to replace my old annotation based command manager. This was created as a private project, but after I seen that some people liked my command manager I released it as a Open Source Project.

Features

  • Is universal. That means that you can use it in whatever plataform you use.
  • Is easy to use.
  • Two bolts doesn't look good
  • Yeah, four bolts look better
  • But five bolts, it's even better!
  • It's annotation based :0

Usage

Here a example of usage in bukkit

    @Command(names = "fly", min = 0, max = 1)
    public boolean flyCommand(CommandSender sender, @Optional("self") String targetName) {
        if (player.equalsIgnoreCase("self") && !(sender instanceof Player)) {
            return false;
        }
        
        Player target;
    
        if(targetName.equals("self")) {
            target = (Player) sender;             
        } else {
            target = Bukkit.getPlayer(targetName);
            
            if(target == null) {
                sender.sendMessage(ChatColor.RED + "The specified target can't be found");
                return true;        
            }            
        }
        
        target.setAllowFlight(!target.getAllowFlight());
        sender.sendMessage(ChatColor.GREEN + "Fly mode of " + target.getName() + ": " + target.getAllowFlight());
        
        return true;    
    }

Ok, thats the command, now let's assume that it is into a class called FlyCommand

To register the command that class needs to implement the class CommandClass Also you need a ParametricCommandHandler. Here how you can register it

parametricCommandHandler.registerCommandClass(new FlyCommand());

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.