Plugin Hooks

View the Plugin Hooking System for CIYFLib.

Often hooking into plugins requires repetitive code and methods may not always be the same, we've implemented an easy system for fast plugin hooking.

1. Create your Hook Class.

public class TestHook extends Hook {

    @Override
    public String getPlugin() {
        return "SomePlugin";
    }

    @Override
    public void onEnable() {
        Bukkit.getLogger().info("Woo, hooking into SomePlugin!");
    }
}

Where "SomePlugin" is the plugin you wish to hook into, and onEnable is the method that gets called if the plugin is installed on the server.

2. Add to Plugin.yml.

Sadly it's not possible to modify a plugin via code for this, so you'll need to go to your plugin.yml and either set it tosoftdepend: ["SomePlugin"] meaning the plugin isn't required, but it's an option (usually what hooks do) or depend: ["SomePlugin"] which tells Bukkit that this plugin is required.

That easy!

Last updated