Java Code Examples for net.runelite.api.events.ChatMessage#getMessage()
The following examples show how to use
net.runelite.api.events.ChatMessage#getMessage() .
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 |
@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: CookingPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
@Subscribe void onChatMessage(ChatMessage event) { if (event.getType() != ChatMessageType.SPAM) { return; } final String message = event.getMessage(); if (message.startsWith("You successfully cook") || message.startsWith("You successfully bake") || message.startsWith("You manage to cook") || message.startsWith("You roast a") || message.startsWith("You cook")) { if (session == null) { session = new CookingSession(); } session.updateLastCookingAction(); session.increaseCookAmount(); } else if (message.startsWith("You accidentally burn") || message.startsWith("You accidentally spoil")) { if (session == null) { session = new CookingSession(); } session.updateLastCookingAction(); session.increaseBurnAmount(); } }
Example 3
Source File: ThievingPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
@Subscribe private void onChatMessage(ChatMessage event) { if (event.getType() != ChatMessageType.SPAM) { return; } final String message = event.getMessage(); if (message.startsWith("You pickpocket") || message.startsWith("You pick-pocket") || message.startsWith("You steal") || message.startsWith("You successfully pick-pocket") || message.startsWith("You successfully pick") || message.startsWith("You successfully steal") || message.startsWith("You pick the knight") || message.startsWith("You pick the Elf")) { if (session == null) { session = new ThievingSession(); } session.updateLastThevingAction(); session.hasSucceeded(); } else if (message.startsWith("You fail to pick") || message.startsWith("You fail to steal")) { if (session == null) { session = new ThievingSession(); } session.updateLastThevingAction(); session.hasFailed(); } }
Example 4
Source File: HiscorePlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
@Subscribe private void onChatMessage(ChatMessage event) { if (!config.bountyLookup() || !event.getType().equals(ChatMessageType.GAMEMESSAGE)) { return; } String message = event.getMessage(); Matcher m = BOUNTY_PATTERN.matcher(message); if (m.matches()) { lookupPlayer(m.group(1)); } }
Example 5
Source File: ChatTranslationPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
@Subscribe private void onChatMessage(ChatMessage chatMessage) { if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN) { return; } switch (chatMessage.getType()) { case PUBLICCHAT: case MODCHAT: case FRIENDSCHAT: break; default: return; } if (!playerNames.contains(Text.toJagexName(Text.removeTags(chatMessage.getName().toLowerCase())))) { return; } final String message = chatMessage.getMessage(); try { final String translation = translator.translateIncoming(message); final MessageNode messageNode = chatMessage.getMessageNode(); messageNode.setRuneLiteFormatMessage(translation); chatMessageManager.update(messageNode); } catch (IOException ignored) { } client.refreshChat(); }
Example 6
Source File: MotherlodePlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
@Subscribe private void onChatMessage(ChatMessage event) { if (!inMlm || event.getType() != ChatMessageType.SPAM) { return; } String chatMessage = event.getMessage(); switch (chatMessage) { case "You manage to mine some pay-dirt.": session.incrementPayDirtMined(); break; case "You just found a Diamond!": session.incrementGemFound(ItemID.UNCUT_DIAMOND); break; case "You just found a Ruby!": session.incrementGemFound(ItemID.UNCUT_RUBY); break; case "You just found an Emerald!": session.incrementGemFound(ItemID.UNCUT_EMERALD); break; case "You just found a Sapphire!": session.incrementGemFound(ItemID.UNCUT_SAPPHIRE); break; } }
Example 7
Source File: OneClickPlugin.java From ExternalPlugins with GNU General Public License v3.0 | 5 votes |
@Subscribe public void onChatMessage(ChatMessage event) { switch (event.getMessage()) { case MAGIC_IMBUE_MESSAGE: imbue = true; break; case MAGIC_IMBUE_EXPIRED_MESSAGE: imbue = false; break; } }
Example 8
Source File: CookingPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Subscribe public void onChatMessage(ChatMessage event) { if (event.getType() != ChatMessageType.SPAM) { return; } final String message = event.getMessage(); if (message.startsWith("You successfully cook") || message.startsWith("You successfully bake") || message.startsWith("You manage to cook") || message.startsWith("You roast a") || message.startsWith("You cook")) { if (session == null) { session = new CookingSession(); } session.updateLastCookingAction(); session.increaseCookAmount(); } else if (message.startsWith("You accidentally burn") || message.startsWith("You accidentally spoil")) { if (session == null) { session = new CookingSession(); } session.updateLastCookingAction(); session.increaseBurnAmount(); } }
Example 9
Source File: HiscorePlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Subscribe public void onChatMessage(ChatMessage event) { if (!config.bountylookup() || !event.getType().equals(ChatMessageType.GAMEMESSAGE)) { return; } String message = event.getMessage(); Matcher m = BOUNTY_PATTERN.matcher(message); if (m.matches()) { lookupPlayer(m.group(1)); } }
Example 10
Source File: MotherlodePlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Subscribe public void onChatMessage(ChatMessage event) { if (!inMlm || event.getType() != ChatMessageType.SPAM) { return; } String chatMessage = event.getMessage(); switch (chatMessage) { case "You manage to mine some pay-dirt.": session.incrementPayDirtMined(); break; case "You just found a Diamond!": session.incrementGemFound(ItemID.UNCUT_DIAMOND); break; case "You just found a Ruby!": session.incrementGemFound(ItemID.UNCUT_RUBY); break; case "You just found an Emerald!": session.incrementGemFound(ItemID.UNCUT_EMERALD); break; case "You just found a Sapphire!": session.incrementGemFound(ItemID.UNCUT_SAPPHIRE); break; } }
Example 11
Source File: SuppliesTrackerPlugin.java From plugins with GNU General Public License v3.0 | 4 votes |
@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); } } }
Example 12
Source File: ChatCommandManager.java From runelite with BSD 2-Clause "Simplified" License | 4 votes |
@Subscribe public void onChatMessage(ChatMessage chatMessage) { if (client.getGameState() != GameState.LOGGED_IN) { return; } switch (chatMessage.getType()) { case PUBLICCHAT: case MODCHAT: case FRIENDSCHAT: case PRIVATECHAT: case MODPRIVATECHAT: case PRIVATECHATOUT: break; default: return; } String message = chatMessage.getMessage(); String command = extractCommand(message); if (command == null) { return; } ChatCommand chatCommand = commands.get(command.toLowerCase()); if (chatCommand == null) { return; } if (chatCommand.isAsync()) { scheduledExecutorService.execute(() -> chatCommand.getExecute().accept(chatMessage, message)); } else { chatCommand.getExecute().accept(chatMessage, message); } }