Java Code Examples for net.runelite.api.events.ChatMessage#getName()

The following examples show how to use net.runelite.api.events.ChatMessage#getName() . 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: ChatFilterPlugin.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
@Subscribe
public void onChatMessage(ChatMessage chatMessage)
{
	if (COLLAPSIBLE_MESSAGETYPES.contains(chatMessage.getType()))
	{
		// remove and re-insert into map to move to end of list
		final String key = chatMessage.getName() + ":" + chatMessage.getMessage();
		Duplicate duplicate = duplicateChatCache.remove(key);
		if (duplicate == null)
		{
			duplicate = new Duplicate();
		}

		duplicate.count++;
		duplicate.messageId = chatMessage.getMessageNode().getId();
		duplicateChatCache.put(key, duplicate);
	}
}
 
Example 2
Source File: LeagueChatIconsPlugin.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Adds the League Icon in front of player names chatting from a league world.
 *
 * @param chatMessage chat message to edit sender name on
 */
private void addLeagueIconToMessage(ChatMessage chatMessage)
{
	String name = chatMessage.getName();
	if (!name.startsWith(IRONMAN_PREFIX))
	{
		// don't replace non-ironman icons, like mods
		return;
	}

	name = Text.removeTags(name);

	final MessageNode messageNode = chatMessage.getMessageNode();
	messageNode.setName(getNameWithIcon(leagueIconOffset, name));

	chatMessageManager.update(messageNode);
	client.refreshChat();
}
 
Example 3
Source File: BronzeManPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
public void onChatMessage(ChatMessage chatMessage)
{
	if (client.getGameState() != GameState.LOGGED_IN || client.getLocalPlayer().getName() == null ||
		chatMessage.getName() == null)
	{
		return;
	}

	String name = Text.removeTags(chatMessage.getName());
	name = Text.sanitize(name);
	String playerName = Text.removeTags(client.getLocalPlayer().getName());
	playerName = Text.sanitize(playerName);

	try
	{
		if (name.equals(playerName) || (name.substring(0, 3)
			.equalsIgnoreCase("bmm")))
		{ //check if player has bmm in his name or if player is local player
			AddIconToMessage(chatMessage);
		}
	}
	catch (StringIndexOutOfBoundsException e)
	{
		log.debug("error processing chat message");
	}
}
 
Example 4
Source File: BronzeManPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private void AddIconToMessage(ChatMessage chatMessage)
{
	String name = chatMessage.getName();
	if (!name.equals(Text.removeTags(name)))
	{
		return;
	}

	final MessageNode messageNode = chatMessage.getMessageNode();
	messageNode.setName(setupBronzeManName(iconOffset, name));
	chatMessageManager.update(messageNode);
	client.refreshChat();
}