net.runelite.client.events.ConfigChanged Java Examples

The following examples show how to use net.runelite.client.events.ConfigChanged. 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: MinimapPlugin.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("minimap"))
	{
		return;
	}

	if (event.getKey().equals("hideMinimap"))
	{
		updateMinimapWidgetVisibility(config.hideMinimap());
		return;
	}

	replaceMapDots();
}
 
Example #2
Source File: TimeTrackingPlugin.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Subscribe
public void onConfigChanged(ConfigChanged e)
{
	if (!e.getGroup().equals(CONFIG_GROUP))
	{
		return;
	}

	if (clockManager.getTimers().isEmpty() && e.getKey().equals(TIMERS))
	{
		clockManager.loadTimers();
	}
	else if (clockManager.getStopwatches().isEmpty() && e.getKey().equals(STOPWATCHES))
	{
		clockManager.loadStopwatches();
	}
}
 
Example #3
Source File: EntityHiderPlugin.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("entityhider"))
	{
		return;
	}
	updateConfig();
	
	if (event.getOldValue() == null || event.getNewValue() == null)
		{
			return;
		}

	if (event.getKey().equals("hideNPCsNames"))
		{
			List<String> oldList = Text.fromCSV(event.getOldValue());
			List<String> newList = Text.fromCSV(event.getNewValue());

			List<String> removed = oldList.stream().filter(s -> !newList.contains(s)).collect(Collectors.toCollection(ArrayList::new));
			List<String> added = newList.stream().filter(s -> !oldList.contains(s)).collect(Collectors.toCollection(ArrayList::new));

			removed.forEach(client::removeHiddenNpcName);
			added.forEach(client::addHiddenNpcName);
		}
}
 
Example #4
Source File: BoostsPlugin.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("boosts"))
	{
		return;
	}

	updateShownSkills();

	if (config.displayNextBuffChange() == BoostsConfig.DisplayChangeMode.NEVER)
	{
		lastChangeDown = -1;
	}

	if (config.displayNextDebuffChange() == BoostsConfig.DisplayChangeMode.NEVER)
	{
		lastChangeUp = -1;
	}
}
 
Example #5
Source File: MirrorPlugin.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("mirror"))
	{
		return;
	}

	SwingUtilities.invokeLater(() ->
	{
		if (jframe != null)
		{
			updateTitle();
		}
	});
}
 
Example #6
Source File: OneClickPlugin.java    From ExternalPlugins with GNU General Public License v3.0 6 votes vote down vote up
@Subscribe
public void onConfigChanged(ConfigChanged event)
{
	if (event.getGroup().equals("oneclick"))
	{
		type = config.getType();
		spellSelection = config.getSpells();
		enableImbue = config.isUsingImbue();
		updateMap();
		if (type == Types.SPELL)
		{
			comparable = spellSelection.getComparable();
		}
		else
		{
			comparable = type.getComparable();
		}
	}
}
 
Example #7
Source File: TimestampPluginTest.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Test
public void testGenerateTimestamp()
{
	when(config.timestampFormat()).thenReturn("[yyyy:MM:dd:HH:hh:mm:ss]");

	ConfigChanged configChanged = new ConfigChanged();
	configChanged.setGroup("timestamp");
	configChanged.setKey("format");
	configChanged.setNewValue("true");
	plugin.onConfigChanged(configChanged);

	int testInput = 1554667116;
	String testOutput = "[2019:04:07:15:03:58:36]";
	TimeZone timeZone = TimeZone.getTimeZone("America/New_York");
	plugin.getFormatter().setTimeZone(timeZone);
	assertTrue(plugin.generateTimestamp(testInput, timeZone.toZoneId()).equals(testOutput));
}
 
Example #8
Source File: GrandExchangePlugin.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(GrandExchangeConfig.CONFIG_GROUP))
	{
		if (event.getKey().equals("quickLookup"))
		{
			if (config.quickLookup())
			{
				mouseManager.registerMouseListener(inputListener);
				keyManager.registerKeyListener(inputListener);
			}
			else
			{
				mouseManager.unregisterMouseListener(inputListener);
				keyManager.unregisterKeyListener(inputListener);
			}
		}
	}
}
 
Example #9
Source File: SlayerPlugin.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("slayer"))
	{
		return;
	}

	if (event.getKey().equals("infobox"))
	{
		if (config.showInfobox())
		{
			clientThread.invoke(this::addCounter);
		}
		else
		{
			removeCounter();
		}
	}
}
 
Example #10
Source File: GrandExchangePlugin.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(GrandExchangeConfig.CONFIG_GROUP))
	{
		if (event.getKey().equals("quickLookup"))
		{
			if (config.quickLookup())
			{
				mouseManager.registerMouseListener(inputListener);
				keyManager.registerKeyListener(inputListener);
			}
			else
			{
				mouseManager.unregisterMouseListener(inputListener);
				keyManager.unregisterKeyListener(inputListener);
			}
		}
	}
}
 
Example #11
Source File: CombatLevelPlugin.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Subscribe
public void onConfigChanged(ConfigChanged event)
{
	if (!CONFIG_GROUP.equals(event.getGroup()) || !ATTACK_RANGE_CONFIG_KEY.equals(event.getKey()))
	{
		return;
	}

	if (config.wildernessAttackLevelRange())
	{
		appendAttackLevelRangeText();
	}
	else
	{
		shutDownAttackLevelRange();
	}
}
 
Example #12
Source File: NpcIndicatorsPluginTest.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
@Test
public void testAliveNpcMenuHighlight()
{
	when(npcIndicatorsConfig.getNpcToHighlight()).thenReturn("goblin");
	when(npcIndicatorsConfig.highlightMenuNames()).thenReturn(true);
	when(npcIndicatorsConfig.getHighlightColor()).thenReturn(Color.BLUE);

	ConfigChanged configChanged = new ConfigChanged();
	configChanged.setGroup("npcindicators");
	npcIndicatorsPlugin.onConfigChanged(configChanged);

	NPC npc = mock(NPC.class);
	when(npc.getName()).thenReturn("Goblin");
	npcIndicatorsPlugin.onNpcSpawned(new NpcSpawned(npc));

	when(client.getCachedNPCs()).thenReturn(new NPC[]{npc}); // id 0

	when(client.getMenuEntries()).thenReturn(new MenuEntry[]{new MenuEntry()});
	MenuEntryAdded menuEntryAdded = new MenuEntryAdded("", "Goblin", MenuOpcode.NPC_FIRST_OPTION.getId(), 0, -1, -1, false);
	npcIndicatorsPlugin.onMenuEntryAdded(menuEntryAdded);

	MenuEntry target = new MenuEntry();
	target.setTarget("<col=0000ff>Goblin"); // blue
	verify(client).setMenuEntries(new MenuEntry[]{target});
}
 
Example #13
Source File: TimeTrackingPlugin.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
@Subscribe
private void onConfigChanged(ConfigChanged e)
{
	if (!e.getGroup().equals(CONFIG_GROUP))
	{
		return;
	}

	if (clockManager.getTimers().isEmpty() && e.getKey().equals(TIMERS))
	{
		clockManager.loadTimers();
	}
	else if (clockManager.getStopwatches().isEmpty() && e.getKey().equals(STOPWATCHES))
	{
		clockManager.loadStopwatches();
	}
}
 
Example #14
Source File: AgilityPlugin.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("agility"))
	{
		return;
	}

	if ("addLevelsToShortcutOptions".equals(event.getKey()))
	{
		if (config.showShortcutLevel())
		{
			addMenuSubscriptions();
		}
		else
		{
			eventBus.unregister(MENU_SUBS);
		}
		return;
	}

	if (!config.showAgilityArenaTimer())
	{
		removeAgilityArenaTimer();
	}
}
 
Example #15
Source File: FriendsChatPlugin.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
@Subscribe
private void onConfigChanged(ConfigChanged configChanged)
{
	if (configChanged.getGroup().equals("clanchat"))
	{
		if (!config.recentChats())
		{
			resetChats();
		}

		if (config.showCounter())
		{
			clientThread.invoke(this::addCounter);
		}
		else
		{
			resetCounter();
		}

		Color ignoreColor = config.showIgnores() ? config.showIgnoresColor() : Color.WHITE;
		clientThread.invoke(() -> colorIgnoredPlayers(ignoreColor));
	}
}
 
Example #16
Source File: NpcIndicatorsPluginTest.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Test
public void testAliveNpcMenuHighlight()
{
	when(npcIndicatorsConfig.getNpcToHighlight()).thenReturn("goblin");
	when(npcIndicatorsConfig.highlightMenuNames()).thenReturn(true);
	when(npcIndicatorsConfig.getHighlightColor()).thenReturn(Color.BLUE);

	ConfigChanged configChanged = new ConfigChanged();
	configChanged.setGroup("npcindicators");
	npcIndicatorsPlugin.onConfigChanged(configChanged);

	NPC npc = mock(NPC.class);
	when(npc.getName()).thenReturn("Goblin");
	npcIndicatorsPlugin.onNpcSpawned(new NpcSpawned(npc));

	when(client.getCachedNPCs()).thenReturn(new NPC[]{npc}); // id 0

	when(client.getMenuEntries()).thenReturn(new MenuEntry[]{new MenuEntry()});
	MenuEntryAdded menuEntryAdded = new MenuEntryAdded("", "Goblin", MenuAction.NPC_FIRST_OPTION.getId(), 0, -1, -1);
	npcIndicatorsPlugin.onMenuEntryAdded(menuEntryAdded);

	MenuEntry target = new MenuEntry();
	target.setTarget("<col=0000ff>Goblin"); // blue
	verify(client).setMenuEntries(new MenuEntry[]{target});
}
 
Example #17
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 #18
Source File: PoisonPlugin.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(PoisonConfig.GROUP))
	{
		return;
	}

	if (!config.showInfoboxes() && infobox != null)
	{
		infoBoxManager.removeInfoBox(infobox);
		infobox = null;
	}

	if (config.changeHealthIcon())
	{
		clientThread.invoke(this::checkHealthIcon);
	}
	else
	{
		clientThread.invoke(this::resetHealthIcon);
	}
}
 
Example #19
Source File: ProfilesPlugin.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("profiles") && event.getKey().equals("rememberPassword"))
	{
		panel = injector.getInstance(ProfilesPanel.class);
		this.shutDown();
		this.startUp();
	}
	if (event.getGroup().equals("profiles") && !event.getKey().equals("rememberPassword"))
	{
		panel = injector.getInstance(ProfilesPanel.class);
		try
		{
			panel.redrawProfiles();
		}
		catch (GeneralSecurityException gse)
		{
			log.error("Error redrawing profiles panel", gse);
		}
	}
}
 
Example #20
Source File: PrivateServerPlugin.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("privateserver"))
	{
		return;
	}

	if (event.getKey().equals("modulus"))
	{
		if (RuneLite.allowPrivateServer && !config.modulus().equals(""))
		{
			client.setModulus(new BigInteger(config.modulus(), 16));
		}
	}
	else if (event.getKey().equals("codebase"))
	{
		StringFileUtils.writeStringToFile(RuneLite.RUNELITE_DIR + "/codebase", config.codebase());
		String message = "Client restart required after codebase change\n";
		JOptionPane.showMessageDialog(ClientUI.getFrame(), message, "Restart required",
			JOptionPane.WARNING_MESSAGE);
	}
}
 
Example #21
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 #22
Source File: NpcIndicatorsPluginTest.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Test
public void testDeadNpcMenuHighlight()
{
	when(npcIndicatorsConfig.getNpcToHighlight()).thenReturn("goblin");
	when(npcIndicatorsConfig.deadNpcMenuColor()).thenReturn(Color.RED);

	ConfigChanged configChanged = new ConfigChanged();
	configChanged.setGroup("npcindicators");
	npcIndicatorsPlugin.onConfigChanged(configChanged);

	NPC npc = mock(NPC.class);
	when(npc.getName()).thenReturn("Goblin");
	when(npc.isDead()).thenReturn(true);
	npcIndicatorsPlugin.onNpcSpawned(new NpcSpawned(npc));

	when(client.getCachedNPCs()).thenReturn(new NPC[]{npc}); // id 0

	when(client.getMenuEntries()).thenReturn(new MenuEntry[]{new MenuEntry()});
	MenuEntryAdded menuEntryAdded = new MenuEntryAdded("", "Goblin", MenuAction.NPC_FIRST_OPTION.getId(), 0, -1, -1);
	npcIndicatorsPlugin.onMenuEntryAdded(menuEntryAdded);

	MenuEntry target = new MenuEntry();
	target.setTarget("<col=ff0000>Goblin"); // red
	verify(client).setMenuEntries(new MenuEntry[]{target});
}
 
Example #23
Source File: HiscorePlugin.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("hiscore"))
	{
		if (client != null)
		{
			menuManager.get().removePlayerMenuItem(LOOKUP);

			if (config.playerOption())
			{
				menuManager.get().addPlayerMenuItem(LOOKUP);
			}
		}
	}
}
 
Example #24
Source File: CannonPlugin.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("cannon"))
	{
		if (!config.showInfobox())
		{
			removeCounter();
		}
		else
		{
			if (cannonPlaced)
			{
				clientThread.invoke(this::addCounter);
			}
		}
	}

}
 
Example #25
Source File: ClueScrollPlugin.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("cluescroll") && !config.displayHintArrows())
	{
		client.clearHintArrow();
	}
}
 
Example #26
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 #27
Source File: ShortcutPlugin.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("shortcut"))
	{
		return;
	}
}
 
Example #28
Source File: CustomClientResizingPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
public void onConfigChanged(ConfigChanged event)
{
	if (customclientresizingProfiles.isEmpty() && event.getGroup().equals(CONFIG_GROUP) && event.getKey().equals(CONFIG_KEY))
	{
		loadConfig(event.getNewValue()).forEach(customclientresizingProfiles::add);
	}


}
 
Example #29
Source File: ChatMessageManager.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("textrecolor"))
	{
		loadColors();
		clientThread.invokeLater(this::refreshAll);
	}
}
 
Example #30
Source File: WintertodtPlugin.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("wintertodt"))
	{
		return;
	}
}