test_class.declarator: menuManager
test_class.modifier: @Inject
  	private
test_class.original_string: @Inject
  	private MenuManager menuManager;
test_class.type: MenuManager
test_class.var_name: menuManager
test_class.declarator: client
test_class.modifier: @Mock
  	@Bind
  	private
test_class.original_string: @Mock
  	@Bind
  	private Client client;
test_class.type: Client
test_class.var_name: client
test_class.declarator: eventBus
test_class.modifier: @Mock
  	@Bind
  	private
test_class.original_string: @Mock
  	@Bind
  	private EventBus eventBus;
test_class.type: EventBus
test_class.var_name: eventBus
test_class.file: runelite-client/src/test/java/net/runelite/client/menus/MenuManagerTest.java
test_class.identifier: MenuManagerTest
test_case.body: @Test
  	public void testPlayerMenuOptionWithBountyHunterEmblemClicked()
  	{
  		MenuOptionClicked event = new MenuOptionClicked();
  		event.setMenuAction(MenuAction.RUNELITE_PLAYER);
  		event.setMenuTarget("username<img=20>5<col=40ff00>  (level-42)");
  
  		menuManager.onMenuOptionClicked(event);
  
  		ArgumentCaptor<PlayerMenuOptionClicked> captor = ArgumentCaptor.forClass(PlayerMenuOptionClicked.class);
  		verify(eventBus).post(captor.capture());
  		PlayerMenuOptionClicked clicked = captor.getValue();
  		assertEquals("username", clicked.getMenuTarget());
  	}
test_case.class_method_signature: MenuManagerTest.testPlayerMenuOptionWithBountyHunterEmblemClicked()
test_case.full_signature: @Test public void testPlayerMenuOptionWithBountyHunterEmblemClicked()
test_case.identifier: testPlayerMenuOptionWithBountyHunterEmblemClicked
test_case.invocations: setMenuAction setMenuTarget onMenuOptionClicked forClass post verify capture getValue assertEquals getMenuTarget
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testPlayerMenuOptionWithBountyHunterEmblemClicked()
focal_class.declarator: IDX_LOWER = 4
focal_class.modifier: private static final
focal_class.original_string: private static final int IDX_LOWER = 4;
focal_class.type: int
focal_class.var_name: IDX_LOWER
focal_class.declarator: IDX_UPPER = 8
focal_class.modifier: private static final
focal_class.original_string: private static final int IDX_UPPER = 8;
focal_class.type: int
focal_class.var_name: IDX_UPPER
focal_class.declarator: BOUNTY_EMBLEM_TAG_AND_TIER_REGEXP = Pattern.compile(String.format("%s[1-9]0?", IconID.BOUNTY_HUNTER_EMBLEM.toString()))
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern BOUNTY_EMBLEM_TAG_AND_TIER_REGEXP = Pattern.compile(String.format("%s[1-9]0?", IconID.BOUNTY_HUNTER_EMBLEM.toString()));
focal_class.type: Pattern
focal_class.var_name: BOUNTY_EMBLEM_TAG_AND_TIER_REGEXP
focal_class.declarator: client
focal_class.modifier: private final
focal_class.original_string: private final Client client;
focal_class.type: Client
focal_class.var_name: client
focal_class.declarator: eventBus
focal_class.modifier: private final
focal_class.original_string: private final EventBus eventBus;
focal_class.type: EventBus
focal_class.var_name: eventBus
focal_class.declarator: playerMenuIndexMap = new HashMap<>()
focal_class.modifier: private final
focal_class.original_string: private final Map<Integer, String> playerMenuIndexMap = new HashMap<>();
focal_class.type: Map<Integer, String>
focal_class.var_name: playerMenuIndexMap
focal_class.declarator: managedMenuOptions = HashMultimap.create()
focal_class.modifier: private final
focal_class.original_string: private final Multimap<Integer, WidgetMenuOption> managedMenuOptions = HashMultimap.create();
focal_class.type: Multimap<Integer, WidgetMenuOption>
focal_class.var_name: managedMenuOptions
focal_class.declarator: npcMenuOptions = new HashSet<>()
focal_class.modifier: private final
focal_class.original_string: private final Set<String> npcMenuOptions = new HashSet<>();
focal_class.type: Set<String>
focal_class.var_name: npcMenuOptions
focal_class.file: runelite-client/src/main/java/net/runelite/client/menus/MenuManager.java
focal_class.identifier: MenuManager
focal_class.class_method_signature: MenuManager.MenuManager(Client client, EventBus eventBus)
focal_class.full_signature: @Inject @VisibleForTesting  MenuManager(Client client, EventBus eventBus)
focal_class.identifier: MenuManager
focal_class.modifiers: @Inject @VisibleForTesting
focal_class.parameters: (Client client, EventBus eventBus)
focal_class.signature:  MenuManager(Client client, EventBus eventBus)
focal_class.class_method_signature: MenuManager.addManagedCustomMenu(WidgetMenuOption customMenuOption)
focal_class.full_signature: public void addManagedCustomMenu(WidgetMenuOption customMenuOption)
focal_class.identifier: addManagedCustomMenu
focal_class.modifiers: public
focal_class.parameters: (WidgetMenuOption customMenuOption)
focal_class.return: void
focal_class.signature: void addManagedCustomMenu(WidgetMenuOption customMenuOption)
focal_class.class_method_signature: MenuManager.removeManagedCustomMenu(WidgetMenuOption customMenuOption)
focal_class.full_signature: public void removeManagedCustomMenu(WidgetMenuOption customMenuOption)
focal_class.identifier: removeManagedCustomMenu
focal_class.modifiers: public
focal_class.parameters: (WidgetMenuOption customMenuOption)
focal_class.return: void
focal_class.signature: void removeManagedCustomMenu(WidgetMenuOption customMenuOption)
focal_class.class_method_signature: MenuManager.menuContainsCustomMenu(WidgetMenuOption customMenuOption)
focal_class.full_signature: private boolean menuContainsCustomMenu(WidgetMenuOption customMenuOption)
focal_class.identifier: menuContainsCustomMenu
focal_class.modifiers: private
focal_class.parameters: (WidgetMenuOption customMenuOption)
focal_class.return: boolean
focal_class.signature: boolean menuContainsCustomMenu(WidgetMenuOption customMenuOption)
focal_class.class_method_signature: MenuManager.onMenuEntryAdded(MenuEntryAdded event)
focal_class.full_signature: @Subscribe public void onMenuEntryAdded(MenuEntryAdded event)
focal_class.identifier: onMenuEntryAdded
focal_class.modifiers: @Subscribe public
focal_class.parameters: (MenuEntryAdded event)
focal_class.return: void
focal_class.signature: void onMenuEntryAdded(MenuEntryAdded event)
focal_class.class_method_signature: MenuManager.addPlayerMenuItem(String menuText)
focal_class.full_signature: public void addPlayerMenuItem(String menuText)
focal_class.identifier: addPlayerMenuItem
focal_class.modifiers: public
focal_class.parameters: (String menuText)
focal_class.return: void
focal_class.signature: void addPlayerMenuItem(String menuText)
focal_class.class_method_signature: MenuManager.removePlayerMenuItem(String menuText)
focal_class.full_signature: public void removePlayerMenuItem(String menuText)
focal_class.identifier: removePlayerMenuItem
focal_class.modifiers: public
focal_class.parameters: (String menuText)
focal_class.return: void
focal_class.signature: void removePlayerMenuItem(String menuText)
focal_class.class_method_signature: MenuManager.onPlayerMenuOptionsChanged(PlayerMenuOptionsChanged event)
focal_class.full_signature: @Subscribe public void onPlayerMenuOptionsChanged(PlayerMenuOptionsChanged event)
focal_class.identifier: onPlayerMenuOptionsChanged
focal_class.modifiers: @Subscribe public
focal_class.parameters: (PlayerMenuOptionsChanged event)
focal_class.return: void
focal_class.signature: void onPlayerMenuOptionsChanged(PlayerMenuOptionsChanged event)
focal_class.class_method_signature: MenuManager.onNpcActionChanged(NpcActionChanged event)
focal_class.full_signature: @Subscribe public void onNpcActionChanged(NpcActionChanged event)
focal_class.identifier: onNpcActionChanged
focal_class.modifiers: @Subscribe public
focal_class.parameters: (NpcActionChanged event)
focal_class.return: void
focal_class.signature: void onNpcActionChanged(NpcActionChanged event)
focal_class.class_method_signature: MenuManager.addNpcOption(NPCComposition composition, String npcOption)
focal_class.full_signature: private void addNpcOption(NPCComposition composition, String npcOption)
focal_class.identifier: addNpcOption
focal_class.modifiers: private
focal_class.parameters: (NPCComposition composition, String npcOption)
focal_class.return: void
focal_class.signature: void addNpcOption(NPCComposition composition, String npcOption)
focal_class.class_method_signature: MenuManager.removeNpcOption(NPCComposition composition, String npcOption)
focal_class.full_signature: private void removeNpcOption(NPCComposition composition, String npcOption)
focal_class.identifier: removeNpcOption
focal_class.modifiers: private
focal_class.parameters: (NPCComposition composition, String npcOption)
focal_class.return: void
focal_class.signature: void removeNpcOption(NPCComposition composition, String npcOption)
focal_class.class_method_signature: MenuManager.onMenuOptionClicked(MenuOptionClicked event)
focal_class.full_signature: @Subscribe public void onMenuOptionClicked(MenuOptionClicked event)
focal_class.identifier: onMenuOptionClicked
focal_class.modifiers: @Subscribe public
focal_class.parameters: (MenuOptionClicked event)
focal_class.return: void
focal_class.signature: void onMenuOptionClicked(MenuOptionClicked event)
focal_class.class_method_signature: MenuManager.addPlayerMenuItem(int playerOptionIndex, String menuText)
focal_class.full_signature: private void addPlayerMenuItem(int playerOptionIndex, String menuText)
focal_class.identifier: addPlayerMenuItem
focal_class.modifiers: private
focal_class.parameters: (int playerOptionIndex, String menuText)
focal_class.return: void
focal_class.signature: void addPlayerMenuItem(int playerOptionIndex, String menuText)
focal_class.class_method_signature: MenuManager.removePlayerMenuItem(int playerOptionIndex)
focal_class.full_signature: private void removePlayerMenuItem(int playerOptionIndex)
focal_class.identifier: removePlayerMenuItem
focal_class.modifiers: private
focal_class.parameters: (int playerOptionIndex)
focal_class.return: void
focal_class.signature: void removePlayerMenuItem(int playerOptionIndex)
focal_class.class_method_signature: MenuManager.findEmptyPlayerMenuIndex()
focal_class.full_signature: private int findEmptyPlayerMenuIndex()
focal_class.identifier: findEmptyPlayerMenuIndex
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int findEmptyPlayerMenuIndex()
focal_method.body: @Subscribe
  	public void onMenuOptionClicked(MenuOptionClicked event)
  	{
  		if (event.getMenuAction() != MenuAction.RUNELITE
  			&& event.getMenuAction() != MenuAction.RUNELITE_PLAYER)
  		{
  			return; // not a managed widget option or custom player option
  		}
  
  		int widgetId = event.getWidgetId();
  		Collection<WidgetMenuOption> options = managedMenuOptions.get(widgetId);
  
  		for (WidgetMenuOption curMenuOption : options)
  		{
  			if (curMenuOption.getMenuTarget().equals(event.getMenuTarget())
  				&& curMenuOption.getMenuOption().equals(event.getMenuOption()))
  			{
  				WidgetMenuOptionClicked customMenu = new WidgetMenuOptionClicked();
  				customMenu.setMenuOption(event.getMenuOption());
  				customMenu.setMenuTarget(event.getMenuTarget());
  				customMenu.setWidget(curMenuOption.getWidget());
  				eventBus.post(customMenu);
  				return; // don't continue because it's not a player option
  			}
  		}
  
  		// removes bounty hunter emblem tag and tier from player name, e.g:
  		// "username<img=20>5<col=40ff00>  (level-42)" -> "username<col=40ff00>  (level-42)"
  		String target = BOUNTY_EMBLEM_TAG_AND_TIER_REGEXP.matcher(event.getMenuTarget()).replaceAll("");
  
  		// removes tags and level from player names for example:
  		// <col=ffffff>username<col=40ff00>  (level-42) or <col=ffffff><img=2>username</col>
  		String username = Text.removeTags(target).split("[(]")[0].trim();
  
  		PlayerMenuOptionClicked playerMenuOptionClicked = new PlayerMenuOptionClicked();
  		playerMenuOptionClicked.setMenuOption(event.getMenuOption());
  		playerMenuOptionClicked.setMenuTarget(username);
  
  		eventBus.post(playerMenuOptionClicked);
  	}
focal_method.class_method_signature: MenuManager.onMenuOptionClicked(MenuOptionClicked event)
focal_method.full_signature: @Subscribe public void onMenuOptionClicked(MenuOptionClicked event)
focal_method.identifier: onMenuOptionClicked
focal_method.invocations: getMenuAction getMenuAction getWidgetId get equals getMenuTarget getMenuTarget equals getMenuOption getMenuOption setMenuOption getMenuOption setMenuTarget getMenuTarget setWidget getWidget post replaceAll matcher getMenuTarget trim split removeTags setMenuOption getMenuOption setMenuTarget post
focal_method.modifiers: @Subscribe public
focal_method.parameters: (MenuOptionClicked event)
focal_method.return: void
focal_method.signature: void onMenuOptionClicked(MenuOptionClicked event)