Class Plugin

java.lang.Object
net.storm.api.plugins.Plugin
All Implemented Interfaces:
com.google.inject.Module, org.pf4j.ExtensionPoint
Direct Known Subclasses:
LoopedPlugin

@Extension public abstract class Plugin extends Object implements com.google.inject.Module, org.pf4j.ExtensionPoint
Abstract base class for all Storm plugins.

Plugins extend this class to create custom automation, bots, or utilities for Old School RuneScape. This class provides lifecycle hooks and dependency injection support via Google Guice.

Example plugin:

 
 @PluginDescriptor(
     name = "My Plugin",
     description = "Does something useful"
 )
 public class MyPlugin extends Plugin {
     @Override
     public void startUp() throws Exception {
         // Plugin initialization
     }

     @Override
     public void shutDown() throws Exception {
         // Plugin cleanup
     }
 }
 
 

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    com.google.inject.Injector
    The Google Guice injector instance for this plugin.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    configure(com.google.inject.Binder binder)
    Configures dependency injection bindings for this plugin.
    final boolean
     
    Gets the plugin name from the PluginDescriptor annotation.
    final int
     
    boolean
    Checks if this plugin was loaded from the Storm SDN (Storm Developer Network).
    void
    Called when the plugin configuration is reset to defaults.
    void
    setToggleHidden(boolean hidden)
    Sets whether the plugin toggle button should be hidden in the UI.
    void
    Called when the plugin is stopped.
    void
    Called when the plugin is started.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • injector

      public com.google.inject.Injector injector
      The Google Guice injector instance for this plugin. Use this to manually retrieve dependencies if needed.
  • Constructor Details

    • Plugin

      public Plugin()
  • Method Details

    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • configure

      public void configure(com.google.inject.Binder binder)
      Configures dependency injection bindings for this plugin.

      Override this method to bind custom dependencies using Google Guice. This method is called during plugin initialization before startUp().

      Specified by:
      configure in interface com.google.inject.Module
      Parameters:
      binder - the Guice binder for configuring dependencies
    • startUp

      public void startUp() throws Exception
      Called when the plugin is started.

      Override this method to perform initialization tasks such as:

      • Registering event listeners
      • Loading configuration
      • Setting up resources
      • Starting background tasks

      Throws:
      Exception - if startup fails
    • shutDown

      public void shutDown() throws Exception
      Called when the plugin is stopped.

      Override this method to perform cleanup tasks such as:

      • Unregistering event listeners
      • Releasing resources
      • Stopping background tasks

      Throws:
      Exception - if shutdown fails
    • resetConfiguration

      public void resetConfiguration()
      Called when the plugin configuration is reset to defaults.

      Override this method if your plugin needs to respond to configuration resets.

    • getName

      public String getName()
      Gets the plugin name from the PluginDescriptor annotation.
      Returns:
      the plugin name
    • isSdn

      public boolean isSdn()
      Checks if this plugin was loaded from the Storm SDN (Storm Developer Network).
      Returns:
      true if this is an SDN plugin, false otherwise
    • setToggleHidden

      public void setToggleHidden(boolean hidden)
      Sets whether the plugin toggle button should be hidden in the UI.

      When set to true, the plugin's toggle button will not be visible to users. This posts a PluginToggleHiddenChanged event.

      Parameters:
      hidden - true to hide the toggle button, false to show it