Class ChatMatch

java.lang.Object
com.petarmc.lib.chat.ChatMatch

public class ChatMatch extends Object
Represents a successful pattern match from a chat message.
  • Field Details

    • originalMessage

      private final String originalMessage
    • matcher

      private final Matcher matcher
    • patternId

      private final String patternId
  • Constructor Details

  • Method Details

    • getOriginalMessage

      public String getOriginalMessage()
      Returns:
      The original chat message that was matched
    • getMatcher

      public Matcher getMatcher()
      Returns:
      The regex matcher containing captured groups
    • getPatternId

      public String getPatternId()
      Returns:
      The ID of the pattern that matched
    • getGroup

      public String getGroup(int group)
      Get a captured group by index
      Parameters:
      group - The group index (1-based)
      Returns:
      The captured string, or null if group doesn't exist
    • getGroupCount

      public int getGroupCount()
      Get the number of captured groups