@Test public void testBankers() { when(config.swapBank()).thenReturn(true); entries = new MenuEntry[]{ menu("Cancel", "", MenuAction.CANCEL), menu("Examine", "Gnome banker", MenuAction.EXAMINE_NPC), menu("Examine", "Gnome banker", MenuAction.EXAMINE_NPC), menu("Walk here", "", MenuAction.WALK), menu("Collect", "Gnome banker", MenuAction.NPC_FOURTH_OPTION), menu("Bank", "Gnome banker", MenuAction.NPC_THIRD_OPTION), menu("Talk-to", "Gnome banker", MenuAction.NPC_FIRST_OPTION), menu("Collect", "Gnome banker", MenuAction.NPC_FOURTH_OPTION), menu("Bank", "Gnome banker", MenuAction.NPC_THIRD_OPTION), menu("Talk-to", "Gnome banker", MenuAction.NPC_FIRST_OPTION), }; menuEntrySwapperPlugin.onClientTick(new ClientTick()); ArgumentCaptor<MenuEntry[]> argumentCaptor = ArgumentCaptor.forClass(MenuEntry[].class); verify(client, times(2)).setMenuEntries(argumentCaptor.capture()); assertArrayEquals(new MenuEntry[]{ menu("Cancel", "", MenuAction.CANCEL), menu("Examine", "Gnome banker", MenuAction.EXAMINE_NPC), menu("Examine", "Gnome banker", MenuAction.EXAMINE_NPC), menu("Walk here", "", MenuAction.WALK), menu("Collect", "Gnome banker", MenuAction.NPC_FOURTH_OPTION), menu("Talk-to", "Gnome banker", MenuAction.NPC_FIRST_OPTION), menu("Bank", "Gnome banker", MenuAction.NPC_THIRD_OPTION), menu("Collect", "Gnome banker", MenuAction.NPC_FOURTH_OPTION), menu("Talk-to", "Gnome banker", MenuAction.NPC_FIRST_OPTION), menu("Bank", "Gnome banker", MenuAction.NPC_THIRD_OPTION), }, argumentCaptor.getValue()); }
@Subscribe public void onClientTick(ClientTick clientTick) { if (client.getGameState() != GameState.LOGGED_IN || client.isMenuOpen()) { return; } MenuEntry[] menuEntries = client.getMenuEntries(); int idx = 0; optionIndexes.clear(); for (MenuEntry entry : menuEntries) { String option = Text.removeTags(entry.getOption()).toLowerCase(); optionIndexes.put(option, idx++); } idx = 0; for (MenuEntry entry : menuEntries) { swapMenuEntry(idx++, entry); } }
MenuEntrySwapperPlugin extends Plugin { @Subscribe public void onClientTick(ClientTick clientTick) { if (client.getGameState() != GameState.LOGGED_IN || client.isMenuOpen()) { return; } MenuEntry[] menuEntries = client.getMenuEntries(); int idx = 0; optionIndexes.clear(); for (MenuEntry entry : menuEntries) { String option = Text.removeTags(entry.getOption()).toLowerCase(); optionIndexes.put(option, idx++); } idx = 0; for (MenuEntry entry : menuEntries) { swapMenuEntry(idx++, entry); } } }
MenuEntrySwapperPlugin extends Plugin { @Subscribe public void onClientTick(ClientTick clientTick) { if (client.getGameState() != GameState.LOGGED_IN || client.isMenuOpen()) { return; } MenuEntry[] menuEntries = client.getMenuEntries(); int idx = 0; optionIndexes.clear(); for (MenuEntry entry : menuEntries) { String option = Text.removeTags(entry.getOption()).toLowerCase(); optionIndexes.put(option, idx++); } idx = 0; for (MenuEntry entry : menuEntries) { swapMenuEntry(idx++, entry); } }  }
MenuEntrySwapperPlugin extends Plugin { @Subscribe public void onClientTick(ClientTick clientTick) { if (client.getGameState() != GameState.LOGGED_IN || client.isMenuOpen()) { return; } MenuEntry[] menuEntries = client.getMenuEntries(); int idx = 0; optionIndexes.clear(); for (MenuEntry entry : menuEntries) { String option = Text.removeTags(entry.getOption()).toLowerCase(); optionIndexes.put(option, idx++); } idx = 0; for (MenuEntry entry : menuEntries) { swapMenuEntry(idx++, entry); } }  @Override void startUp(); @Override void shutDown(); @Subscribe void onConfigChanged(ConfigChanged event); @Subscribe void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event); @Subscribe void onMenuOpened(MenuOpened event); @Subscribe void onMenuEntryAdded(MenuEntryAdded menuEntryAdded); @Subscribe void onMenuOptionClicked(MenuOptionClicked event); @Subscribe void onClientTick(ClientTick clientTick); @Subscribe void onPostItemComposition(PostItemComposition event); }
MenuEntrySwapperPlugin extends Plugin { @Subscribe public void onClientTick(ClientTick clientTick) { if (client.getGameState() != GameState.LOGGED_IN || client.isMenuOpen()) { return; } MenuEntry[] menuEntries = client.getMenuEntries(); int idx = 0; optionIndexes.clear(); for (MenuEntry entry : menuEntries) { String option = Text.removeTags(entry.getOption()).toLowerCase(); optionIndexes.put(option, idx++); } idx = 0; for (MenuEntry entry : menuEntries) { swapMenuEntry(idx++, entry); } }  @Override void startUp(); @Override void shutDown(); @Subscribe void onConfigChanged(ConfigChanged event); @Subscribe void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event); @Subscribe void onMenuOpened(MenuOpened event); @Subscribe void onMenuEntryAdded(MenuEntryAdded menuEntryAdded); @Subscribe void onMenuOptionClicked(MenuOptionClicked event); @Subscribe void onClientTick(ClientTick clientTick); @Subscribe void onPostItemComposition(PostItemComposition event);  }