Working with Events

Master RuneLite's event system. Learn how to 'listen' to game actions like XP drops and game ticks using the example-plugin framework.

4 steps
Progress1 / 4 steps
1

The Subscribe Annotation

Step 1 of 4

Objective

Learn the core syntax for listening to events in ExamplePlugin.java.

Explanation

RuneLite uses an 'Event Bus' to communicate. For your plugin to react to game actions, you must use the '@Subscribe' annotation. In your 'ExamplePlugin.java', any method marked with @Subscribe will be automatically registered when the plugin starts. **Note:** The method must be 'public' and contain exactly one parameter (the event type).

Your Code

java
AdvertisementSet slotId on <AdUnit /> to show ads.