Skip to main content

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.

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 current client.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). Passing null bypasses matching for that argument.
  • contains(option, target): Returns true if firstMatching finds a match.
  • diagnostics(): Formats current entries as option -> target strings separated by semicolons, providing ideal context for logging and failure analysis.

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.