promotional bannermobile promotional banner

MondoCommand

Abandoned
Library that will let you handle sub-commands with ease!

One of the most irking things about developing bukkit plugins is handling commands, especially when you want to do the more common approach these days of having a single outer command with multiple sub-actions nested inside it (and don't get me started on sub-sub-actions).

You've probably tried it, and very soon entire function blocks start to look like a huge if-elseif-else scenario. Well worry not, there's a new library in town, and it's going to make the headache about dealing with sub-commands go away.

Features

  • Lets you register many sub-commands and let you separate the code how you like (multiple methods, classes, whatever) with minimal headache.
  • Enforces permissions on individual sub-commands
  • Generates a colorful help screen automatically: Usage Output
  • Handles gracefully player-only commands vs commands for consoles
  • Lets you do pretty formatted color output without having to bang your head against the ChatColor class.

How To Set Up

Step One Add MondoCommand to your build path. I recommend you use maven so that you can easily update MondoCommand, and so that you can properly shade the code into your jar.

Step Two In your plugin, probably in your main class, add these imports:

import mondocommand.MondoCommand;
import mondocommand.CallInfo;
import mondocommand.dynamic.Sub; // Optional, for dynamic command registration.

Step Three Now register your MondoCommand (probably in onEnable)

MondoCommand base = new MondoCommand();
base.autoRegisterFrom(this);
getCommand("yourcommand").setExecutor(base);

Step Four Now you're ready to start writing commands. A simple command looks like this:

@Sub(description="Build a House", minArgs=2, usage="<owner> <name>")
public void build(CallInfo call) {
    String owner = call.getArg(0);
    String name = call.getArg(1);
    if (houseMap.containsKey(name)) {
        call.reply("House with name %s already exists", name);
    } else {
        // TODO add code to actually make a house
        call.reply("House %s made!", name);
    }
}

See the Docs for more examples

Links

The MondoCommand Team

profile avatar
  • 3
    Projects
  • 39.3K
    Downloads

More from _ForgeUser298170

  • MondoChest project image

    MondoChest

    • 32.3K
    • Bukkit Plugins

    Dump all your items into one chest, and have them sorted into multiple chests, even in another room!

    • 32.3K
    • May 26, 2014
    • Bukkit Plugins
  • MineralManager project image

    MineralManager

    • 26.5K
    • Bukkit Plugins

    Allows blocks a chance to respawn increasing resources per chunk.

    • 26.5K
    • July 15, 2013
    • Bukkit Plugins
    • +3
  • FlyingTub project image

    FlyingTub

    • 6.1K
    • Bukkit Plugins

    Make your carts jump/fly long distances

    • 6.1K
    • June 5, 2014
    • Bukkit Plugins
    • +1
  • MondoChest project image

    MondoChest

    • 32.3K
    • Bukkit Plugins

    Dump all your items into one chest, and have them sorted into multiple chests, even in another room!

    • 32.3K
    • May 26, 2014
    • Bukkit Plugins
  • MineralManager project image

    MineralManager

    • 26.5K
    • Bukkit Plugins

    Allows blocks a chance to respawn increasing resources per chunk.

    • 26.5K
    • July 15, 2013
    • Bukkit Plugins
    • +3
  • FlyingTub project image

    FlyingTub

    • 6.1K
    • Bukkit Plugins

    Make your carts jump/fly long distances

    • 6.1K
    • June 5, 2014
    • Bukkit Plugins
    • +1