Java Code Examples for net.runelite.api.GameState#HOPPING

The following examples show how to use net.runelite.api.GameState#HOPPING . 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: RaidsPlugin.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{
	if (client.getGameState() == GameState.LOGGED_IN)
	{
		// skip event while the game decides if the player belongs in a raid or not
		if (client.getLocalPlayer() == null
			|| client.getLocalPlayer().getWorldLocation().equals(TEMP_LOCATION))
		{
			return;
		}

		checkInRaid = true;
	}
	else if (client.getGameState() == GameState.LOGIN_SCREEN
		|| client.getGameState() == GameState.CONNECTION_LOST)
	{
		loggedIn = false;
	}
	else if (client.getGameState() == GameState.HOPPING)
	{
		reset();
	}
}
 
Example 2
Source File: ItemManager.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onGameStateChanged(final GameStateChanged event)
{
	if (event.getGameState() == GameState.HOPPING || event.getGameState() == GameState.LOGIN_SCREEN)
	{
		itemCompositions.invalidateAll();
	}
}
 
Example 3
Source File: FishingPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onGameStateChanged(GameStateChanged gameStateChanged)
{
	GameState gameState = gameStateChanged.getGameState();
	if (gameState == GameState.CONNECTION_LOST || gameState == GameState.LOGIN_SCREEN || gameState == GameState.HOPPING)
	{
		fishingSpots.clear();
		minnowSpots.clear();
	}
}
 
Example 4
Source File: FriendsChatPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onGameStateChanged(GameStateChanged state)
{
	GameState gameState = state.getGameState();

	if (gameState == GameState.LOGIN_SCREEN || gameState == GameState.CONNECTION_LOST || gameState == GameState.HOPPING)
	{
		members.clear();
		resetCounter();

		joinMessages.clear();
	}
}
 
Example 5
Source File: ImplingsPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{
	if (event.getGameState() == GameState.LOGIN_SCREEN || event.getGameState() == GameState.HOPPING)
	{
		implings.clear();
	}
}
 
Example 6
Source File: NpcIndicatorsPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{
	if (event.getGameState() == GameState.LOGIN_SCREEN ||
		event.getGameState() == GameState.HOPPING)
	{
		highlightedNpcs.clear();
		deadNpcsToDisplay.clear();
		memorizedNpcs.forEach((id, npc) -> npc.setDiedOnTick(-1));
		lastPlayerLocation = null;
		skipNextSpawnCheck = true;
	}
}
 
Example 7
Source File: RegenMeterPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
private void onGameStateChanged(GameStateChanged ev)
{
	if (ev.getGameState() == GameState.HOPPING || ev.getGameState() == GameState.LOGIN_SCREEN)
	{
		ticksSinceHPRegen = -2; // For some reason this makes this accurate
		ticksSinceSpecRegen = 0;
	}
}
 
Example 8
Source File: PestControlPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{
	GameState gameState = event.getGameState();
	if (gameState == GameState.CONNECTION_LOST || gameState == GameState.LOGIN_SCREEN || gameState == GameState.HOPPING)
	{
		spinners.clear();
	}
}
 
Example 9
Source File: KourendLibraryPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{
	if (event.getGameState() == GameState.LOGIN_SCREEN ||
		event.getGameState() == GameState.HOPPING)
	{
		npcsToMark.clear();
	}
}
 
Example 10
Source File: KourendLibraryPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{
	if (event.getGameState() == GameState.LOGIN_SCREEN ||
		event.getGameState() == GameState.HOPPING)
	{
		npcsToMark.clear();
	}
}
 
Example 11
Source File: FishingPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onGameStateChanged(GameStateChanged gameStateChanged)
{
	GameState gameState = gameStateChanged.getGameState();
	if (gameState == GameState.CONNECTION_LOST || gameState == GameState.LOGIN_SCREEN || gameState == GameState.HOPPING)
	{
		fishingSpots.clear();
		minnowSpots.clear();
	}
}
 
Example 12
Source File: FriendsChatPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onGameStateChanged(GameStateChanged state)
{
	GameState gameState = state.getGameState();

	if (gameState == GameState.LOGIN_SCREEN || gameState == GameState.CONNECTION_LOST || gameState == GameState.HOPPING)
	{
		members.clear();
		resetCounter();

		joinMessages.clear();
	}
}
 
Example 13
Source File: ImplingsPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
	if (event.getGameState() == GameState.LOGIN_SCREEN || event.getGameState() == GameState.HOPPING)
	{
		implings.clear();
		implingCounterMap.clear();
	}
}
 
Example 14
Source File: NpcIndicatorsPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
	if (event.getGameState() == GameState.LOGIN_SCREEN ||
		event.getGameState() == GameState.HOPPING)
	{
		highlightedNpcs.clear();
		deadNpcsToDisplay.clear();
		pendingNotificationNpcs.clear();
		memorizedNpcs.forEach((id, npc) -> npc.setDiedOnTick(-1));
		lastPlayerLocation = null;
		skipNextSpawnCheck = true;
	}
}
 
Example 15
Source File: NpcStatusPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
	if (event.getGameState() == GameState.LOGIN_SCREEN ||
		event.getGameState() == GameState.HOPPING)
	{
		memorizedNPCs.clear();
	}
}
 
Example 16
Source File: SpawnTimerPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
	if (event.getGameState() == GameState.LOGIN_SCREEN ||
		event.getGameState() == GameState.HOPPING)
	{
		highlightedNpcs.clear();
		ticks.clear();
	}
}
 
Example 17
Source File: StatusOrbsPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onGameStateChanged(GameStateChanged ev)
{
	if (ev.getGameState() == GameState.HOPPING || ev.getGameState() == GameState.LOGIN_SCREEN)
	{
		ticksSinceHPRegen = -2; // For some reason this makes this accurate
		ticksSinceSpecRegen = 0;
		ticksSinceRunRegen = -1;
	}
}
 
Example 18
Source File: XpTrackerPlugin.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe
void onGameStateChanged(GameStateChanged event)
{
	GameState state = event.getGameState();
	if (state == GameState.LOGGED_IN)
	{
		// LOGGED_IN is triggered between region changes too.
		// Check that the username changed or the world type changed.
		XpWorldType type = worldSetToType(client.getWorldType());

		if (!Objects.equals(client.getUsername(), lastUsername) || lastWorldType != type)
		{
			// Reset
			log.debug("World change: {} -> {}, {} -> {}",
				lastUsername, client.getUsername(),
				Objects.requireNonNullElse(lastWorldType, "<unknown>"),
				Objects.requireNonNullElse(type, "<unknown>"));

			lastUsername = client.getUsername();
			// xp is not available until after login is finished, so fetch it on the next gametick
			fetchXp = true;
			lastWorldType = type;
			resetState();
			// Must be set from hitting the LOGGING_IN or HOPPING case below
			assert initializeTracker;
		}
	}
	else if (state == GameState.LOGGING_IN || state == GameState.HOPPING)
	{
		initializeTracker = true;
	}
	else if (state == GameState.LOGIN_SCREEN)
	{
		Player local = client.getLocalPlayer();
		if (local == null)
		{
			return;
		}

		String username = local.getName();
		if (username == null)
		{
			return;
		}

		long totalXp = client.getOverallExperience();
		// Don't submit xptrack unless xp threshold is reached
		if (Math.abs(totalXp - lastXp) > XP_THRESHOLD)
		{
			xpClient.update(username);
			lastXp = totalXp;
		}
	}
}
 
Example 19
Source File: XpTrackerPlugin.java    From runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{
	GameState state = event.getGameState();
	if (state == GameState.LOGGED_IN)
	{
		// LOGGED_IN is triggered between region changes too.
		// Check that the username changed or the world type changed.
		XpWorldType type = worldSetToType(client.getWorldType());

		if (!Objects.equals(client.getUsername(), lastUsername) || lastWorldType != type)
		{
			// Reset
			log.debug("World change: {} -> {}, {} -> {}",
				lastUsername, client.getUsername(),
				firstNonNull(lastWorldType, "<unknown>"),
				firstNonNull(type, "<unknown>"));

			lastUsername = client.getUsername();
			// xp is not available until after login is finished, so fetch it on the next gametick
			fetchXp = true;
			lastWorldType = type;
			resetState();
			// Must be set from hitting the LOGGING_IN or HOPPING case below
			assert initializeTracker;
		}
	}
	else if (state == GameState.LOGGING_IN || state == GameState.HOPPING)
	{
		initializeTracker = true;
	}
	else if (state == GameState.LOGIN_SCREEN)
	{
		Player local = client.getLocalPlayer();
		if (local == null)
		{
			return;
		}

		String username = local.getName();
		if (username == null)
		{
			return;
		}

		long totalXp = client.getOverallExperience();
		// Don't submit xptrack unless xp threshold is reached
		if (Math.abs(totalXp - lastXp) > XP_THRESHOLD)
		{
			xpClient.update(username);
			lastXp = totalXp;
		}
	}
}