Java Code Examples for net.runelite.api.events.MenuOptionClicked#getMenuOption()
The following examples show how to use
net.runelite.api.events.MenuOptionClicked#getMenuOption() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChatHistoryPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Subscribe public void onMenuOptionClicked(MenuOptionClicked event) { final String menuOption = event.getMenuOption(); // The menu option for clear history is "<col=ffff00>Public:</col> Clear history" if (menuOption.endsWith(CLEAR_HISTORY)) { clearChatboxHistory(ChatboxTab.of(event.getWidgetId())); } else if (COPY_TO_CLIPBOARD.equals(menuOption) && !Strings.isNullOrEmpty(currentMessage)) { final StringSelection stringSelection = new StringSelection(Text.removeTags(currentMessage)); Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stringSelection, null); } }
Example 2
Source File: ClueScrollPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Subscribe public void onMenuOptionClicked(final MenuOptionClicked event) { if (event.getMenuOption() != null && event.getMenuOption().equals("Read")) { final ItemComposition itemComposition = itemManager.getItemComposition(event.getId()); if (itemComposition != null && (itemComposition.getName().startsWith("Clue scroll") || itemComposition.getName().startsWith("Challenge scroll"))) { clueItemId = itemComposition.getId(); updateClue(MapClue.forItemId(clueItemId)); } } }
Example 3
Source File: XpTrackerPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Subscribe public void onMenuOptionClicked(MenuOptionClicked event) { if (event.getMenuAction().getId() != MenuAction.RUNELITE.getId() || TO_GROUP(event.getWidgetId()) != WidgetID.SKILLS_GROUP_ID) { return; } final Skill skill; try { skill = Skill.valueOf(Text.removeTags(event.getMenuTarget()).toUpperCase()); } catch (IllegalArgumentException ex) { log.debug(null, ex); return; } switch (event.getMenuOption()) { case MENUOP_ADD_CANVAS_TRACKER: addOverlay(skill); break; case MENUOP_REMOVE_CANVAS_TRACKER: removeOverlay(skill); break; } }
Example 4
Source File: MenuEntrySwapperPlugin.java From runelite with BSD 2-Clause "Simplified" License | 4 votes |
@Subscribe public void onMenuOptionClicked(MenuOptionClicked event) { if (event.getMenuAction() != MenuAction.RUNELITE || event.getWidgetId() != WidgetInfo.INVENTORY.getId()) { return; } int itemId = event.getId(); if (itemId == -1) { return; } String option = event.getMenuOption(); String target = event.getMenuTarget(); ItemComposition itemComposition = client.getItemDefinition(itemId); if (option.equals(RESET) && target.equals(MENU_TARGET)) { unsetSwapConfig(itemId); return; } if (!itemComposition.getName().equals(Text.removeTags(target))) { return; } if (option.equals("Use")) //because "Use" is not in inventoryActions { setSwapConfig(itemId, -1); } else { String[] inventoryActions = itemComposition.getInventoryActions(); for (int index = 0; index < inventoryActions.length; index++) { if (option.equals(inventoryActions[index])) { setSwapConfig(itemId, index); break; } } } }