Package net.storm.api.plugins
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
FieldsModifier and TypeFieldDescriptioncom.google.inject.InjectorThe Google Guice injector instance for this plugin. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(com.google.inject.Binder binder) Configures dependency injection bindings for this plugin.final booleangetName()Gets the plugin name from thePluginDescriptorannotation.final inthashCode()booleanisSdn()Checks if this plugin was loaded from the Storm SDN (Storm Developer Network).voidCalled when the plugin configuration is reset to defaults.voidsetToggleHidden(boolean hidden) Sets whether the plugin toggle button should be hidden in the UI.voidshutDown()Called when the plugin is stopped.voidstartUp()Called when the plugin is started.
-
Field Details
-
injector
public com.google.inject.Injector injectorThe 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() -
equals
-
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:
configurein interfacecom.google.inject.Module- Parameters:
binder- the Guice binder for configuring dependencies
-
startUp
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
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
Gets the plugin name from thePluginDescriptorannotation.- 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
PluginToggleHiddenChangedevent.- Parameters:
hidden- true to hide the toggle button, false to show it
-