Plugin
The base class of every plugin.
Abstract classRuneLiteRuneLite docs
public abstract class Plugin implements ModuleExtended by VitaPlugin
Extend it, add PluginDescriptor to your class and override startUp() and shutDown(). RuneLite creates your plugin itself, so keep the constructor without arguments, or leave it out.
Example
package com.example.mine;
import net.runelite.api.events.GameTick;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@PluginDescriptor(name = "My Plugin", description = "What it does", tags = {"example"})
public final class MyPlugin extends Plugin {
private int ticks;
@Override
protected void startUp() {
ticks = 0;
}
@Override
protected void shutDown() {
ticks = 0;
}
@Subscribe
public void onGameTick(GameTick tick) {
ticks++;
}
}Members
Constructors
- newPlugin()
Creates the plugin. Your class's constructor calls it for you.
Methods
- voidshutDown()
Runs when the player turns the plugin off.
- voidstartUp()
Runs when the player turns the plugin on.
Plugin()
public Plugin()Creates the plugin. Your class's constructor calls it for you.
shutDown()
protected void shutDown() throws ExceptionRuns when the player turns the plugin off.
Stop what your plugin is doing and reset its fields, so it starts clean the next time.
startUp()
protected void startUp() throws ExceptionRuns when the player turns the plugin on.
Set up your fields here. Your Subscribe methods receive events after this returns.