Interface Plugin


public interface Plugin
Entry point of a hackware plugin.

The class named by main in the plugin's hackware.plugin.json must implement this interface and expose a public no-argument constructor. The loader instantiates it once, then calls onEnable(PluginContext).

Everything a plugin contributes — modules, categories, commands, HUD elements, ClickGUI tabs, scripting providers — is registered through the PluginContext handed to onEnable, so the loader can attribute it back to this plugin and tear it down again on unload.

Throwing from onEnable disables the plugin: the stack trace is printed to the console and the failure is reported in chat. Everything the plugin registered before the throw is rolled back.


 public final class ExamplePlugin implements Plugin {
     @Override
     public void onEnable(PluginContext ctx) {
         ctx.registerModule(new MyModule());
     }
 }
 
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Called when the plugin is unloaded or disabled after an error.
    void
    Called once after the plugin is loaded, before the client applies saved configuration — so modules registered here receive their persisted settings and keybinds.
  • Method Details

    • onEnable

      void onEnable(PluginContext context)
      Called once after the plugin is loaded, before the client applies saved configuration — so modules registered here receive their persisted settings and keybinds.
      Parameters:
      context - registration surface and plugin-scoped services
    • onDisable

      default void onDisable()
      Called when the plugin is unloaded or disabled after an error. Anything registered through the PluginContext is removed automatically; override only to release resources the loader cannot see (threads, files, native handles).