Java Code Examples for net.runelite.api.events.GameStateChanged#getGameState()

The following examples show how to use net.runelite.api.events.GameStateChanged#getGameState() . 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: DiscordPlugin.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{
	switch (event.getGameState())
	{
		case LOGIN_SCREEN:
			checkForGameStateUpdate();
			return;
		case LOGGING_IN:
			loginFlag = true;
			break;
		case LOGGED_IN:
			if (loginFlag)
			{
				loginFlag = false;
				checkForGameStateUpdate();
			}

			break;
	}

	checkForAreaUpdate();
}
 
Example 2
Source File: ObjectIndicatorsPlugin.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Subscribe
public void onGameStateChanged(GameStateChanged gameStateChanged)
{
	GameState gameState = gameStateChanged.getGameState();
	if (gameState == GameState.LOADING)
	{
		// Reload points with new map regions

		points.clear();
		for (int regionId : client.getMapRegions())
		{
			// load points for region
			final Set<ObjectPoint> regionPoints = loadPoints(regionId);
			if (regionPoints != null)
			{
				points.put(regionId, regionPoints);
			}
		}
	}

	if (gameStateChanged.getGameState() != GameState.LOGGED_IN)
	{
		objects.clear();
	}
}
 
Example 3
Source File: GroundMarkerPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onGameStateChanged(GameStateChanged gameStateChanged)
{
	if (gameStateChanged.getGameState() != GameState.LOGGED_IN)
	{
		return;
	}

	// map region has just been updated
	loadPoints();
}
 
Example 4
Source File: FriendChatManager.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onGameStateChanged(GameStateChanged gameStateChanged)
{
	if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN && offset == 0)
	{
		loadRankIcons();
	}
}
 
Example 5
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 6
Source File: CorpPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onGameStateChanged(GameStateChanged gameStateChanged)
{
	if (gameStateChanged.getGameState() == GameState.LOADING)
	{
		players.clear();
	}
}
 
Example 7
Source File: BlastFurnacePlugin.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.LOADING)
	{
		conveyorBelt = null;
		barDispenser = null;
	}
}
 
Example 8
Source File: GroundMarkerPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onGameStateChanged(GameStateChanged gameStateChanged)
{
	if (gameStateChanged.getGameState() != GameState.LOGGED_IN)
	{
		return;
	}

	// map region has just been updated
	loadPoints();
}
 
Example 9
Source File: GrandExchangePlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onGameStateChanged(GameStateChanged gameStateChanged)
{
	if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN)
	{
		panel.getOffersPanel().resetOffers();
		loginBurstGeUpdates = true;
	}
}
 
Example 10
Source File: MenuEntrySwapperPlugin.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.LOGGED_IN)
	{
		keyManager.unregisterKeyListener(ctrlHotkey);
		keyManager.unregisterKeyListener(hotkey);
		return;
	}

	keyManager.registerKeyListener(ctrlHotkey);
	keyManager.registerKeyListener(hotkey);
}
 
Example 11
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 12
Source File: EmojiPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
void onGameStateChanged(GameStateChanged gameStateChanged)
{
	if (gameStateChanged.getGameState() == GameState.LOGGED_IN)
	{
		loadEmojiIcons();
	}
}
 
Example 13
Source File: XpGlobesPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{
	switch (event.getGameState())
	{
		case HOPPING:
		case LOGGING_IN:
			resetGlobeState();
			break;
	}
}
 
Example 14
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 15
Source File: GroundItemsPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onGameStateChanged(final GameStateChanged event)
{
	if (event.getGameState() == GameState.LOADING)
	{
		collectedGroundItems.clear();
	}
}
 
Example 16
Source File: ItemDropper.java    From ExternalPlugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{
	if (event.getGameState() == GameState.LOGGED_IN)
	{
		updateConfig();
	}
}
 
Example 17
Source File: BlastMinePlugin.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.LOADING)
	{
		rocks.clear();
	}
}
 
Example 18
Source File: PohPlugin.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.LOADING)
	{
		pohObjects.clear();
		incenseBurners.clear();
	}
}
 
Example 19
Source File: SkyboxPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onGameStateChanged(GameStateChanged gameStateChanged)
{
	if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN)
	{
		client.setSkyboxColor(0);
	}
}
 
Example 20
Source File: CorpPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onGameStateChanged(GameStateChanged gameStateChanged)
{
	if (gameStateChanged.getGameState() == GameState.LOADING)
	{
		players.clear();
	}
}