MondoCommand

This project is abandoned and its default file will likely not work with the most recent version of Minecraft. Whether this project is out of date or its author has marked it as abandoned, this project is no longer maintained.

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

About This Project

  • Project ID
    54467
  • Created
    Mar 23, 2013
  • Last Released File
    Mar 23, 2013
  • Total Downloads
    739
  • License

Categories

Members

Recent Files