runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java
/**
	 * Checks if the chat message is a command.
	 *
	 * @param setMessage The chat message.
	 */
Checks if the chat message is a command.
@param setMessage The chat message.
Checks if the chat message is a command . @param setMessage The chat message .
@Subscribe
	public void onSetMessage(SetMessage setMessage)
	{
		if (client.getGameState() != GameState.LOGGED_IN)
		{
			return;
		}
		switch (setMessage.getType())
		{
			case PUBLIC:
			case CLANCHAT:
			case PRIVATE_MESSAGE_RECEIVED:
			case PRIVATE_MESSAGE_SENT:
				break;
			default:
				return;
		}
		String message = setMessage.getValue();
		MessageNode messageNode = setMessage.getMessageNode();
		messageNode.setRuneLiteFormatMessage(null);
		if (config.lvl() && message.toLowerCase().equals("!total"))
		{
			log.debug("Running total level lookup");
			executor.submit(() -> playerSkillLookup(setMessage.getType(), setMessage, "total"));
		}
		else if (config.price() && message.toLowerCase().startsWith("!price") && message.length() > 7)
		{
			String search = message.substring(7);
			log.debug("Running price lookup for {}", search);
			executor.submit(() -> itemPriceLookup(setMessage.getMessageNode(), search));
		}
		else if (config.lvl() && message.toLowerCase().startsWith("!lvl") && message.length() > 5)
		{
			String search = message.substring(5);
			log.debug("Running level lookup for {}", search);
			executor.submit(() -> playerSkillLookup(setMessage.getType(), setMessage, search));
		}
	}
@ Subscribe public void onSetMessage ( SetMessage setMessage ) { if ( client . getGameState ( ) != GameState . LOGGED_IN ) { return ; } switch ( setMessage . getType ( ) ) { case PUBLIC : case CLANCHAT : case PRIVATE_MESSAGE_RECEIVED : case PRIVATE_MESSAGE_SENT : break ; default : return ; } String message = setMessage . getValue ( ) ; MessageNode messageNode = setMessage . getMessageNode ( ) ; messageNode . setRuneLiteFormatMessage ( null ) ; if ( config . lvl ( ) && message . toLowerCase ( ) . equals ( "!total" ) ) { log . debug ( "Running total level lookup" ) ; executor . submit ( ( ) -> playerSkillLookup ( setMessage . getType ( ) , setMessage , "total" ) ) ; } else if ( config . price ( ) && message . toLowerCase ( ) . startsWith ( "!price" ) && message . length ( ) > 7 ) { String search = message . substring ( 7 ) ; log . debug ( "Running price lookup for {}" , search ) ; executor . submit ( ( ) -> itemPriceLookup ( setMessage . getMessageNode ( ) , search ) ) ; } else if ( config . lvl ( ) && message . toLowerCase ( ) . startsWith ( "!lvl" ) && message . length ( ) > 5 ) { String search = message . substring ( 5 ) ; log . debug ( "Running level lookup for {}" , search ) ; executor . submit ( ( ) -> playerSkillLookup ( setMessage . getType ( ) , setMessage , search ) ) ; } }
Checks if the chat message is a command.
Checks if the chat message is a command .
// clear RuneLite formatted message as the message node is // being reused