Java Code Examples for net.runelite.api.ChatMessageType#GAMEMESSAGE

The following examples show how to use net.runelite.api.ChatMessageType#GAMEMESSAGE . 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: WoodcuttingPlugin.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Subscribe
public void onChatMessage(ChatMessage event)
{
	if (event.getType() == ChatMessageType.SPAM || event.getType() == ChatMessageType.GAMEMESSAGE)
	{
		if (WOOD_CUT_PATTERN.matcher(event.getMessage()).matches())
		{
			if (session == null)
			{
				session = new WoodcuttingSession();
			}

			session.setLastChopping();
		}

		if (event.getMessage().contains("A bird's nest falls out of the tree") && config.showNestNotification())
		{
			notifier.notify("A bird nest has spawned!");
		}
	}
}
 
Example 2
Source File: ChatNotificationsPluginTest.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
@Test
public void testHighlightOwnName()
{
	Player player = mock(Player.class);
	when(player.getName()).thenReturn("Logic Knot");
	when(client.getLocalPlayer()).thenReturn(player);

	when(config.highlightOwnName()).thenReturn(true);

	MessageNode messageNode = mock(MessageNode.class);
	when(messageNode.getValue()).thenReturn("<col=005f00>Logic Knot received a drop: Adamant longsword</col>");
	ChatMessage chatMessage = new ChatMessage(messageNode, ChatMessageType.GAMEMESSAGE, "", "", "", 0);
	chatNotificationsPlugin.onChatMessage(chatMessage);

	verify(messageNode).setValue("<col=005f00><colHIGHLIGHT><u>Logic Knot</u><colNORMAL> received a drop: Adamant longsword</col>");
}
 
Example 3
Source File: ChatNotificationsPluginTest.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Test
public void testHighlightOwnName()
{
	Player player = mock(Player.class);
	when(player.getName()).thenReturn("Logic Knot");
	when(client.getLocalPlayer()).thenReturn(player);

	when(config.highlightOwnName()).thenReturn(true);

	MessageNode messageNode = mock(MessageNode.class);
	when(messageNode.getValue()).thenReturn("<col=005f00>Logic Knot received a drop: Adamant longsword</col>");
	ChatMessage chatMessage = new ChatMessage(messageNode, ChatMessageType.GAMEMESSAGE, "", "", "", 0);
	chatNotificationsPlugin.onChatMessage(chatMessage);

	verify(messageNode).setValue("<col=005f00><colHIGHLIGHT><u>Logic Knot</u><colNORMAL> received a drop: Adamant longsword</col>");
}
 
Example 4
Source File: CannonPlugin.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
@Subscribe
private void onChatMessage(ChatMessage event)
{
	if (event.getType() != ChatMessageType.SPAM && event.getType() != ChatMessageType.GAMEMESSAGE)
	{
		return;
	}

	if (event.getMessage().equals("You add the furnace."))
	{
		addCounter();
	}

	if (event.getMessage().contains("You pick up the cannon")
		|| event.getMessage().contains("Your cannon has decayed. Speak to Nulodion to get a new one!"))
	{
		removeCounter();
	}
}
 
Example 5
Source File: RunecraftPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onChatMessage(ChatMessage event)
{
	if (event.getType() != ChatMessageType.GAMEMESSAGE)
	{
		return;
	}

	if (config.degradingNotification() && event.getMessage().contains(POUCH_DECAYED_MESSAGE))
	{
		notifier.notify(POUCH_DECAYED_NOTIFICATION_MESSAGE);
	}
}
 
Example 6
Source File: KourendLibraryPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onChatMessage(ChatMessage event)
{
	if (lastBookcaseAnimatedOn != null && event.getType() == ChatMessageType.GAMEMESSAGE)
	{
		if (event.getMessage().equals("You don't find anything useful here."))
		{
			library.mark(lastBookcaseAnimatedOn, null);
			updateBooksPanel();
			lastBookcaseAnimatedOn = null;
		}
	}
}
 
Example 7
Source File: PestControlPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onChatMessage(ChatMessage chatMessage)
{
	if (overlay.getGame() != null && chatMessage.getType() == ChatMessageType.GAMEMESSAGE)
	{
		Matcher matcher = SHIELD_DROP.matcher(chatMessage.getMessage());
		if (matcher.lookingAt())
		{
			overlay.getGame().fall(matcher.group(1));
		}
	}
}
 
Example 8
Source File: TimeTrackingPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onChatMessage(ChatMessage event)
{
	if (event.getType() != ChatMessageType.GAMEMESSAGE || !event.getMessage().equals(CONTRACT_COMPLETED))
	{
		return;
	}

	farmingContractManager.setContract(null);
}
 
Example 9
Source File: TimeTrackingPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
public void onChatMessage(ChatMessage event)
{
	if (event.getType() != ChatMessageType.GAMEMESSAGE || !event.getMessage().equals(CONTRACT_COMPLETED))
	{
		return;
	}

	farmingContractManager.setContract(null);
}
 
Example 10
Source File: ClueScrollPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onChatMessage(ChatMessage event)
{
	if (event.getType() != ChatMessageType.GAMEMESSAGE && event.getType() != ChatMessageType.SPAM)
	{
		return;
	}

	if (clue instanceof HotColdClue)
	{
		if (((HotColdClue) clue).update(event.getMessage(), this))
		{
			worldMapPointsSet = false;
		}
	}

	if (clue instanceof SkillChallengeClue)
	{
		String text = Text.removeTags(event.getMessage());
		if (text.equals("Skill challenge completed.") ||
			text.equals("You have completed your master level challenge!") ||
			text.startsWith("You have completed Charlie's task,") ||
			text.equals("You have completed this challenge scroll."))
		{
			((SkillChallengeClue) clue).setChallengeCompleted(true);
		}
	}
}
 
Example 11
Source File: LootTrackerPluginTest.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void testFirstClue()
{
	ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", "You have completed 1 master Treasure Trail.", "", 0);
	lootTrackerPlugin.onChatMessage(chatMessage);

	assertEquals("Clue Scroll (Master)", lootTrackerPlugin.eventType);
	assertEquals(LootRecordType.EVENT, lootTrackerPlugin.lootRecordType);
}
 
Example 12
Source File: ClueScrollPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
public void onChatMessage(ChatMessage event)
{
	if (event.getType() != ChatMessageType.GAMEMESSAGE && event.getType() != ChatMessageType.SPAM)
	{
		return;
	}

	if (clue instanceof HotColdClue)
	{
		if (((HotColdClue) clue).update(event.getMessage(), this))
		{
			worldMapPointsSet = false;
		}
	}

	if (clue instanceof SkillChallengeClue)
	{
		String text = Text.removeTags(event.getMessage());
		if (text.equals("Skill challenge completed.") ||
			text.equals("You have completed your master level challenge!") ||
			text.startsWith("You have completed Charlie's task,") ||
			text.equals("You have completed this challenge scroll."))
		{
			((SkillChallengeClue) clue).setChallengeCompleted(true);
		}
	}
}
 
Example 13
Source File: GrandExchangePlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onChatMessage(ChatMessage event)
{
	if (!config.enableNotifications() || event.getType() != ChatMessageType.GAMEMESSAGE)
	{
		return;
	}

	String message = Text.removeTags(event.getMessage());

	if (message.startsWith("Grand Exchange:"))
	{
		this.notifier.notify(message);
	}
}
 
Example 14
Source File: WorldHopperPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onChatMessage(ChatMessage event)
{
	if (event.getType() != ChatMessageType.GAMEMESSAGE)
	{
		return;
	}

	if (event.getMessage().equals("Please finish what you're doing before using the World Switcher."))
	{
		resetQuickHopper();
	}
}
 
Example 15
Source File: KourendLibraryPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onChatMessage(ChatMessage event)
{
	if (lastBookcaseAnimatedOn != null && event.getType() == ChatMessageType.GAMEMESSAGE)
	{
		if (event.getMessage().equals("You don't find anything useful here."))
		{
			library.mark(lastBookcaseAnimatedOn, null);
			updateBooksPanel();
			lastBookcaseAnimatedOn = null;
		}
	}
}
 
Example 16
Source File: WoodcuttingPluginTest.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void testBirdsNest()
{
	ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BIRDS_NEST_MESSAGE, "", 0);

	when(woodcuttingConfig.showNestNotification()).thenReturn(true);
	woodcuttingPlugin.onChatMessage(chatMessage);
	verify(notifier).notify("A bird nest has spawned!");

	when(woodcuttingConfig.showNestNotification()).thenReturn(false);
	woodcuttingPlugin.onChatMessage(chatMessage);
	verifyNoMoreInteractions(notifier);
}
 
Example 17
Source File: WoodcuttingPluginTest.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testBirdsNest()
{
	ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BIRDS_NEST_MESSAGE, "", 0);

	when(woodcuttingConfig.showNestNotification()).thenReturn(true);
	woodcuttingPlugin.onChatMessage(chatMessage);
	verify(notifier).notify("A bird nest has spawned!");

	when(woodcuttingConfig.showNestNotification()).thenReturn(false);
	woodcuttingPlugin.onChatMessage(chatMessage);
	verifyNoMoreInteractions(notifier);
}
 
Example 18
Source File: NightmareZonePlugin.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe
private void onChatMessage(ChatMessage event)
{
	if (event.getType() != ChatMessageType.GAMEMESSAGE
		|| !isInNightmareZone())
	{
		return;
	}

	String msg = Text.removeTags(event.getMessage()); //remove color
	if (msg.contains("The effects of overload have worn off, and you feel normal again."))
	{
		if (config.overloadNotification())
		{
			notifier.notify("Your overload has worn off");
		}
	}
	else if (msg.contains("A power-up has spawned:"))
	{
		if (msg.contains("Power surge"))
		{
			if (config.powerSurgeNotification())
			{
				notifier.notify(msg);
			}
		}
		else if (msg.contains("Recurrent damage"))
		{
			if (config.recurrentDamageNotification())
			{
				notifier.notify(msg);
			}
		}
		else if (msg.contains("Zapper"))
		{
			if (config.zapperNotification())
			{
				notifier.notify(msg);
			}
		}
		else if (msg.contains("Ultimate force"))
		{
			if (config.ultimateForceNotification())
			{
				notifier.notify(msg);
			}
		}
	}
}
 
Example 19
Source File: NightmareZonePlugin.java    From runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Subscribe
public void onChatMessage(ChatMessage event)
{
	if (event.getType() != ChatMessageType.GAMEMESSAGE
			|| !isInNightmareZone())
	{
		return;
	}

	String msg = Text.removeTags(event.getMessage()); //remove color
	if (msg.contains("The effects of overload have worn off, and you feel normal again."))
	{
		if (config.overloadNotification())
		{
			notifier.notify("Your overload has worn off");
		}
	}
	else if (msg.contains("A power-up has spawned:"))
	{
		if (msg.contains("Power surge"))
		{
			if (config.powerSurgeNotification())
			{
				notifier.notify(msg);
			}
		}
		else if (msg.contains("Recurrent damage"))
		{
			if (config.recurrentDamageNotification())
			{
				notifier.notify(msg);
			}
		}
		else if (msg.contains("Zapper"))
		{
			if (config.zapperNotification())
			{
				notifier.notify(msg);
			}
		}
		else if (msg.contains("Ultimate force"))
		{
			if (config.ultimateForceNotification())
			{
				notifier.notify(msg);
			}
		}
	}
}
 
Example 20
Source File: SuppliesTrackerPlugin.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe
void onChatMessage(ChatMessage event)
{
	String message = event.getMessage();

	if (event.getType() == ChatMessageType.GAMEMESSAGE || event.getType() == ChatMessageType.SPAM)
	{
		if (message.toLowerCase().contains("you plant "))
		{
			farming.OnChatPlant(message.toLowerCase());
		}
		else if (message.toLowerCase().contains("you treat "))
		{
			farming.setEndlessBucket(message);
			farming.OnChatTreat(message.toLowerCase());
		}
		else if (message.toLowerCase().contains("you bury the bones"))
		{
			prayer.OnChat(message);
		}
		else if (message.toLowerCase().contains("you eat the sweets."))
		{
			buildEntries(PURPLE_SWEETS_10476);
		}
		else if (message.toLowerCase().contains("dark lord"))
		{
			skipBone = true;
		}
		else if (message.toLowerCase().contains("your amulet has") ||
			message.toLowerCase().contains("your amulet's last charge"))
		{
			buildChargesEntries(AMULET_OF_GLORY6);
		}
		else if (message.toLowerCase().contains("your ring of dueling has") ||
			message.toLowerCase().contains("your ring of dueling crumbles"))
		{
			buildChargesEntries(RING_OF_DUELING8);
		}
		else if (message.toLowerCase().contains("your ring of wealth has"))
		{
			buildChargesEntries(RING_OF_WEALTH_5);
		}
		else if (message.toLowerCase().contains("your combat bracelet has") ||
			message.toLowerCase().contains("your combat bracelet's last charge"))
		{
			buildChargesEntries(COMBAT_BRACELET6);
		}
		else if (message.toLowerCase().contains("your games necklace has") ||
			message.toLowerCase().contains("your games necklace crumbles"))
		{
			buildChargesEntries(GAMES_NECKLACE8);
		}
		else if (message.toLowerCase().contains("your skills necklace has") ||
			message.toLowerCase().contains("your skills necklace's last charge"))
		{
			buildChargesEntries(SKILLS_NECKLACE6);
		}
		else if (message.toLowerCase().contains("your necklace of passage has") ||
			message.toLowerCase().contains("your necklace of passage crumbles"))
		{
			buildChargesEntries(NECKLACE_OF_PASSAGE5);
		}
		else if (message.toLowerCase().contains("your burning amulet has") ||
			message.toLowerCase().contains("your burning amulet crumbles"))
		{
			buildChargesEntries(BURNING_AMULET5);
		}
		else if (event.getMessage().contains("A magical chest")
			&& event.getMessage().contains("outside the Theatre of Blood"))
		{
			buildEntries(HEALER_ICON_20802);
		}
		else if (event.getMessage().contains("Torfinn has retrieved some of your items."))
		{
			buildEntries(HEALER_ICON_22308);
		}
	}
}