SlayerPlugin extends Plugin { @Subscribe public void onGameStateChanged(GameStateChanged event) { switch (event.getGameState()) { case HOPPING: case LOGGING_IN: cachedXp = -1; taskName = ""; amount = 0; loginFlag = true; highlightedTargets.clear(); taggedNpcs.clear(); break; case LOGGED_IN: if (config.amount() != -1 && !config.taskName().isEmpty() && loginFlag) { setExpeditiousChargeCount(config.expeditious()); setSlaughterChargeCount(config.slaughter()); setTask(config.taskName(), config.amount(), config.initialAmount(), config.taskLocation(), false); loginFlag = false; } break; } }  @Subscribe void onGameStateChanged(GameStateChanged event); @Subscribe void onNpcSpawned(NpcSpawned npcSpawned); @Subscribe void onNpcDespawned(NpcDespawned npcDespawned); @Subscribe void onGameTick(GameTick tick); @Subscribe void onChatMessage(ChatMessage event); @Subscribe void onStatChanged(StatChanged statChanged); @Subscribe void onHitsplatApplied(HitsplatApplied hitsplatApplied); @Subscribe void onActorDeath(ActorDeath actorDeath);  }
@Test public void infoboxNotAddedOnLogin() { when(slayerConfig.taskName()).thenReturn(Task.BLOODVELD.getName()); GameStateChanged loggingIn = new GameStateChanged(); loggingIn.setGameState(GameState.LOGGING_IN); slayerPlugin.onGameStateChanged(loggingIn); GameStateChanged loggedIn = new GameStateChanged(); loggedIn.setGameState(GameState.LOGGED_IN); slayerPlugin.onGameStateChanged(loggedIn); verify(infoBoxManager, never()).addInfoBox(any()); }