@Test public void testSlayerMaster() { lenient().when(config.swapTrade()).thenReturn(true); when(config.swapAssignment()).thenReturn(true); entries = new MenuEntry[]{ menu("Cancel", "", MenuAction.CANCEL), menu("Rewards", "Duradel", MenuAction.NPC_FIFTH_OPTION), menu("Trade", "Duradel", MenuAction.NPC_FOURTH_OPTION), menu("Assignment", "Duradel", MenuAction.NPC_THIRD_OPTION), menu("Talk-to", "Duradel", MenuAction.NPC_FIRST_OPTION), }; menuEntrySwapperPlugin.onClientTick(new ClientTick()); ArgumentCaptor<MenuEntry[]> argumentCaptor = ArgumentCaptor.forClass(MenuEntry[].class); verify(client).setMenuEntries(argumentCaptor.capture()); assertArrayEquals(new MenuEntry[]{ menu("Cancel", "", MenuAction.CANCEL), menu("Rewards", "Duradel", MenuAction.NPC_FIFTH_OPTION), menu("Trade", "Duradel", MenuAction.NPC_FOURTH_OPTION), menu("Talk-to", "Duradel", MenuAction.NPC_FIRST_OPTION), menu("Assignment", "Duradel", 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);  }