Menu System
Learn how to modify right-click menus, add custom menu options, and interact with the game's menu system.
The menu system in RuneLite allows you to modify right-click menus that appear when you interact with game objects, NPCs, players, and items.
How Menus Work
When you right-click in the game, RuneLite builds a menu of available actions. Your plugin can:
- Add new menu entries
- Remove existing entries
- Reorder entries
- Modify entry text
MenuEntryAdded Event
The MenuEntryAdded event fires for each menu entry as it's added. You can:
- Check the entry's type, target, and option
- Add your own entries
- Remove unwanted entries
Common Use Cases
- Add "Teleport" options to NPCs
- Add "Highlight" options to items
- Remove clutter from menus
- Reorder menu items for better UX
Best Practices
- Always check entry types before modifying
- Don't modify menus unnecessarily (performance)
- Test with different game objects
- Be careful not to break game functionality
Code Examples
Example 1
1// Add a custom menu entry using MenuManager (recommended)
2@Inject
3private MenuManager menuManager;
4
5@Subscribe
6public void onMenuEntryAdded(MenuEntryAdded event) {
7 if (event.getType() == MenuAction.NPC_FIRST_OPTION) {
8 menuManager.addPriorityEntry("My Custom Action", event.getTarget());
9 }
10}
11
12@Override
13protected void shutDown() {
14 menuManager.removePriorityEntry("My Custom Action", "*"); // or specific target
15}