Using Generic and API Calls

You can use mods.plugin.callAPI(pluginName, APIName, params) from your plugin to call exported API methods in other plugins, for example NickServ?:

boolean isAuthed = (Boolean)mods.plugin.callAPI("NickServ", "Check", nickname);

You'd make that API method like this:

public boolean apiStatus(String nickName)
{
    /* Check NickServ status */
    return status;
}

Note that callAPI always returns an Object no matter what your API method specifies, so you must use a cast.

Generics are similar. To call a generic in a plugin, your plugin needs the ChoobPermission? generic.<name>. For example, generic.help would allow you to call the generics named helpSomething. Defining a generic is just like defining an API call. The generic name is all of the lowercase letters up to the first uppercase, so fredBloggs is of type "fred", name "Bloggs".

To call a generic API call, use mods.plugin.callGeneric(pluginName, type, name, params) - it works just like callAPI.

As a shorthand, an API or Generic call that takes no parameters and always returns the same thing may be defined simply as a field, so that:

public String helloString = "Hello, World.";

Is completely equivalent to:

public String helloString()
{
    return "Hello, World.";
}