Menu Entries
The com.n3plugins.sdk.menu package provides immutable snapshots of the client's current menu entries for diagnostic purposes and failure analysis. For action matching and execution, see the Action Resolver documentation.
warning
Avoid dispatching actions directly using MenuEntrySnapshot. Utilize Api.actions.* and ActionResolver for execution, reserving these snapshot APIs strictly for inspection.
MenuEntriesApi
List<MenuEntrySnapshot> entries = MenuEntriesApi.entries();
Optional<MenuEntrySnapshot> bank = MenuEntriesApi.firstMatching("Bank", "Banker");
boolean hasTakeCoins = MenuEntriesApi.contains("Take", "Coins");
log.debug("Current menu entries: {}", MenuEntriesApi.diagnostics());
Key Methods
entries(): Captures currentclient.getMenuEntries()as an immutable list. Returns an empty list if the client or entries disappear.firstMatching(option, target): Retrieves the first entry matching the normalized option and target (case-insensitive). Passingnullbypasses matching for that argument.contains(option, target): Returns true iffirstMatchingfinds a match.diagnostics(): Formats current entries asoption -> targetstrings separated by semicolons, providing ideal context for logging and failure analysis.
MenuEntrySnapshot
MenuEntrySnapshot sanitizes text by stripping RuneLite tags and trimming whitespace during capture. It encapsulates:
getOption()getTarget()getIdentifier()getType()getParam0()getParam1()getItemId()getWorldViewId()isDeprioritized()
Snapshots provide essential context when an InteractionResult yields ACTION_NOT_FOUND, allowing developers to inspect the exact menu state provided by the client.