Java Code Examples for net.runelite.client.events.ConfigChanged#getKey()

The following examples show how to use net.runelite.client.events.ConfigChanged#getKey() . 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: StatusOrbsPlugin.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
	if (event.getGroup().equals("statusorbs"))
	{
		switch (event.getKey())
		{
			case "replaceOrbText":
				if (!config.replaceOrbText())
				{
					resetRunOrbText();
				}
				break;
			case "dynamicHpHeart":
				if (config.dynamicHpHeart())
				{
					checkHealthIcon();
				}
				else
				{
					resetHealthIcon();
				}
				break;
		}
	}
}
 
Example 2
Source File: FriendNotesPlugin.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
@Subscribe
public void onConfigChanged(ConfigChanged event)
{
	if (!event.getGroup().equals(CONFIG_GROUP))
	{
		return;
	}

	switch (event.getKey())
	{
		case "showIcons":
			if (client.getGameState() == GameState.LOGGED_IN)
			{
				rebuildFriendsList();
				rebuildIgnoreList();
			}
			break;
	}
}
 
Example 3
Source File: FriendNotesPlugin.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Subscribe
public void onConfigChanged(ConfigChanged event)
{
	if (!event.getGroup().equals(CONFIG_GROUP))
	{
		return;
	}

	switch (event.getKey())
	{
		case "showIcons":
			if (client.getGameState() == GameState.LOGGED_IN)
			{
				rebuildFriendsList();
				rebuildIgnoreList();
			}
			break;
	}
}
 
Example 4
Source File: NpcAggroAreaPlugin.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Subscribe
public void onConfigChanged(ConfigChanged event)
{
	String key = event.getKey();
	switch (key)
	{
		case "npcUnaggroAlwaysActive":
			recheckActive();
			break;
		case "npcUnaggroShowTimer":
			if (currentTimer != null)
			{
				currentTimer.setVisible(active && config.showTimer());
			}
			break;
		case "npcUnaggroCollisionDetection":
		case "npcUnaggroShowAreaLines":
			calculateLinesToDisplay();
			break;
		case "npcUnaggroNames":
			npcNamePatterns = NAME_SPLITTER.splitToList(config.npcNamePatterns());
			recheckActive();
			break;
	}
}
 
Example 5
Source File: StealingArtefactsPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
	if (event.getGroup().equals(CONFIG_GROUP_NAME))
	{
		initConfig();

		switch (event.getKey())
		{
			case CONFIG_ITEM_NAME_INFOBOX:
				if (displayHouseInfoBox)
				{
					addHouseInfoBox();
				}
				else
				{
					removeHouseInfoBox();
				}
				break;
			case CONFIG_ITEM_NAME_HINT_ARROW:
				removeWorldMapPoint();
				removeHintArrow();

				if (displayHintArrow)
				{
					addWorldMapPoint();
					addHintArrow();
				}
				break;
			default:
				break;
		}
	}
}
 
Example 6
Source File: OpponentInfoPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
	if (!event.getGroup().equals("opponentinfo"))
	{
		return;
	}

	switch (event.getKey())
	{
		case "showAttackersMenu":
			this.showAttackers = config.showAttackersMenu();
			updateMenuSubs();
			break;
		case "showAttackingMenu":
			this.showAttacking = config.showAttackingMenu();
			updateMenuSubs();
			break;
		case "showHitpointsMenu":
			this.showHitpoints = config.showHitpointsMenu();
			updateMenuSubs();
			break;
		case "attackingColor":
			attackingColTag = ColorUtil.colorTag(config.attackingColor());
			break;
	}
}
 
Example 7
Source File: NpcAggroAreaPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
	if (!event.getGroup().equals("npcUnaggroArea"))
	{
		return;
	}

	String key = event.getKey();
	switch (key)
	{
		case "npcUnaggroAlwaysActive":
			recheckActive();
			break;
		case "npcUnaggroShowTimer":
			if (currentTimer != null)
			{
				currentTimer.setVisible(active && config.showTimer());
			}
			break;
		case "npcUnaggroCollisionDetection":
		case "npcUnaggroShowAreaLines":
			calculateLinesToDisplay();
			break;
		case "npcUnaggroNames":
			npcNamePatterns = NAME_SPLITTER.splitToList(config.npcNamePatterns());
			recheckActive();
			break;
		case "sendNotification":
			hasSentNotification = false;
			break;
	}
}
 
Example 8
Source File: AttackStylesPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
@VisibleForTesting
void onConfigChanged(ConfigChanged event)
{
	if (event.getGroup().equals("attackIndicator"))
	{
		boolean enabled = Boolean.TRUE.toString().equals(event.getNewValue());
		switch (event.getKey())
		{
			case "warnForDefensive":
				updateWarnedSkills(enabled, Skill.DEFENCE);
				break;
			case "warnForAttack":
				updateWarnedSkills(enabled, Skill.ATTACK);
				break;
			case "warnForStrength":
				updateWarnedSkills(enabled, Skill.STRENGTH);
				break;
			case "warnForRanged":
				updateWarnedSkills(enabled, Skill.RANGED);
				break;
			case "warnForMagic":
				updateWarnedSkills(enabled, Skill.MAGIC);
				break;
			case "removeWarnedStyles":
				hideWarnedStyles(enabled);
				break;
		}
		processWidgets();
	}
}
 
Example 9
Source File: WorldHopperPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onConfigChanged(final ConfigChanged event)
{
	if (event.getGroup().equals(WorldHopperConfig.GROUP))
	{
		switch (event.getKey())
		{
			case "showSidebar":
				if (config.showSidebar())
				{
					clientToolbar.addNavigation(navButton);
				}
				else
				{
					clientToolbar.removeNavigation(navButton);
				}
				break;
			case "ping":
				if (config.ping())
				{
					SwingUtilities.invokeLater(() -> panel.showPing());
				}
				else
				{
					SwingUtilities.invokeLater(() -> panel.hidePing());
				}
				break;
			case "subscriptionFilter":
				panel.setFilterMode(config.subscriptionFilter());
				updateList();
				break;
		}
	}
}
 
Example 10
Source File: MenuEntrySwapperPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
	if (!"menuentryswapper".equals(event.getGroup()))
	{
		return;
	}

	removeSwaps();
	addSwaps();

	switch (event.getKey())
	{
		case "customSwaps":
			loadCustomSwaps(config.customSwaps(), customSwaps);
			return;
		case "removeObjects":
		case "removedObjects":
			updateRemovedObjects();
			return;
	}

	if (event.getKey().startsWith("swapSell") || event.getKey().startsWith("swapBuy") ||
		(event.getKey().startsWith("sell") || event.getKey().startsWith("buy")) && event.getKey().endsWith("Items"))
	{
		removeBuySellEntries();
		updateBuySellEntries();
		addBuySellEntries();
	}
	else if (event.getKey().startsWith("withdraw") || event.getKey().startsWith("deposit"))
	{
		removeWithdrawEntries();
		updateWithdrawEntries();
		addWithdrawEntries();
	}
}
 
Example 11
Source File: AntiDragPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
	if (event.getGroup().equals("antiDrag"))
	{
		switch (event.getKey())
		{
			case "toggleKeyBind":
			case "holdKeyBind":
				updateKeyListeners();
				break;
			case "alwaysOn":
				client.setInventoryDragDelay(config.alwaysOn() ? config.dragDelay() : DEFAULT_DELAY);
				setBankDragDelay(config.alwaysOn() ? config.bankDragDelay() : DEFAULT_DELAY);
				break;
			case "dragDelay":
			case "bankDragDelay":
					setDragDelay();
				break;
			case ("changeCursor"):
				clientUI.resetCursor();
				break;
			case ("color"):
				overlay.setColor(config.color());
				break;
		}
	}
}
 
Example 12
Source File: AttackStylesPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onConfigChanged(ConfigChanged event)
{
	if (event.getGroup().equals("attackIndicator"))
	{
		boolean enabled = Boolean.TRUE.toString().equals(event.getNewValue());
		switch (event.getKey())
		{
			case "warnForDefensive":
				updateWarnedSkills(enabled, Skill.DEFENCE);
				break;
			case "warnForAttack":
				updateWarnedSkills(enabled, Skill.ATTACK);
				break;
			case "warnForStrength":
				updateWarnedSkills(enabled, Skill.STRENGTH);
				break;
			case "warnForRanged":
				updateWarnedSkills(enabled, Skill.RANGED);
				break;
			case "warnForMagic":
				updateWarnedSkills(enabled, Skill.MAGIC);
				break;
			case "removeWarnedStyles":
				hideWarnedStyles(enabled);
				break;
		}
		processWidgets();
	}
}
 
Example 13
Source File: WorldHopperPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onConfigChanged(final ConfigChanged event)
{
	if (event.getGroup().equals(WorldHopperConfig.GROUP))
	{
		switch (event.getKey())
		{
			case "showSidebar":
				if (config.showSidebar())
				{
					clientToolbar.addNavigation(navButton);
				}
				else
				{
					clientToolbar.removeNavigation(navButton);
				}
				break;
			case "ping":
				if (config.ping())
				{
					SwingUtilities.invokeLater(() -> panel.showPing());
				}
				else
				{
					SwingUtilities.invokeLater(() -> panel.hidePing());
				}
				break;
			case "subscriptionFilter":
				panel.setFilterMode(config.subscriptionFilter());
				updateList();
				break;
		}
	}
}
 
Example 14
Source File: BarbarianAssaultPlugin.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe
private void onConfigChanged(ConfigChanged configChanged)
{
	//not client thread be careful
	if (!configChanged.getGroup().equals("barbarianAssault"))
	{
		return;
	}

	switch (configChanged.getKey())
	{
		case "showTimer":
			if (!config.showTimer())
			{
				showRoleSprite();
			}
			break;

		case "swapLadder":
		case "swapCollectorBag":
		case "swapDestroyEggs":
			if (Boolean.parseBoolean(configChanged.getNewValue()))
			{
				menu.enableSwaps();
			}
			else
			{
				menu.disableSwaps(false);
			}
			break;

		case "showDefTimer":
			if (config.showDefTimer() && getRole() == Role.DEFENDER)
			{
				addTickTimer();
			}
			else
			{
				removeTickTimer();
			}
			break;

		case "showDeathTimes":
		case "showDeathTimesMode":
			if (config.showDeathTimes()
				&& (config.showDeathTimesMode() == DeathTimesMode.INFO_BOX
				|| config.showDeathTimesMode() == DeathTimesMode.BOTH))
			{
				addAllDeathTimes();
			}
			else
			{
				removeAllDeathTimes(false);
			}
			break;

		case "removePenanceCave":
		case "removeUnusedMenus":
		case "removeWrongPoison":
			clientThread.invoke(() -> menu.validateHiddenMenus(getRole()));
			break;

		case "removeIncorrectAttackStyles":
			if (!config.removeIncorrectAttackStyles())
			{
				clientThread.invoke(this::showAllStyles);
			}
			break;
	}
}
 
Example 15
Source File: ChatTranslationPlugin.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
	if (!event.getGroup().equals("chattranslation"))
	{
		return;
	}

	switch (event.getKey())
	{
		case "translateOptionVisible":
			if (config.translateOptionVisible())
			{
				menuManager.addPlayerMenuItem(TRANSLATE);
				eventBus.subscribe(MenuOpened.class, TRANSLATE, this::onMenuOpened);
				eventBus.subscribe(MenuOptionClicked.class, TRANSLATE, this::onMenuOptionClicked);
			}
			else
			{
				menuManager.removePlayerMenuItem(TRANSLATE);
				eventBus.unregister(TRANSLATE);
			}
			break;
		case "publicChat":
			if (config.publicChat())
			{
				eventBus.subscribe(ChatMessage.class, PUBLIC, this::onChatMessage);
			}
			else
			{
				eventBus.unregister(PUBLIC);
			}
			break;
		case "playerNames":
			playerNames.clear();
			for (String names : Text.fromCSV(config.playerNames().toLowerCase()))
			{
				playerNames.add(Text.toJagexName(names));
			}
			break;
		case "publicTargetLanguage":
			translator.setInLang(config.publicTargetLanguage());
			break;
		case "playerChat":
			if (config.playerChat())
			{
				keyManager.registerKeyListener(this);
			}
			else
			{
				keyManager.unregisterKeyListener(this);
			}
			break;
		case "playerTargetLanguage":
			translator.setOutLang(config.playerTargetLanguage());
			break;
	}
}