Interface SocialContextualParser

All Known Subinterfaces:
SocialFilterLike, SocialIdentifiedParser, SocialUserInputParser
All Known Implementing Classes:
SocialContextualKeyword, SocialContextualPlaceholder, SocialFilterLiteral, SocialFilterRegex, SocialParserGroup

public interface SocialContextualParser
The SocialContextualParser interface defines methods for parsing context information and transforming it into Component representations. Implementations of this interface provide custom parsing logic based on the context provided.
See Also:
  • Method Details

    • parse

      Parses the given SocialParserContext and returns a Component representation.
      Parameters:
      context - the context in which the message is being parsed. It contains information such as the sender, the original message, and other contextual information.
      Returns:
      a Component representing the parsed message.
    • supportsOfflinePlayers

      default boolean supportsOfflinePlayers()
      Checks if this parser supports offline players. The default implementation returns false, but can be overridden by implementations that need to handle offline players.
      Returns:
      true if the parser supports offline players, otherwise false.
    • requestList

      static Component requestList(@NotNull @NotNull SocialParserContext context, @NotNull @NotNull List<? extends SocialContextualParser> requestedParsers)
      Processes a list of parsers in sequence, applying each parser to the given SocialParserContext.

      The context's message is progressively updated by each parser in the list.

      Parameters:
      context - the context to parse the message within.
      requestedParsers - the list of parsers to apply in order.
      Returns:
      a Component representing the final parsed message after all parsers have been applied.
    • request

      static Component request(@NotNull @NotNull SocialParserContext context, @NotNull @NotNull Class<?>... requestedParsers)
      Processes a list of parsers provided by their class types, retrieving the first available parser from the Social instance's TextProcessor. This allows parsing to be performed based on specific parser types passed as class references.
      Parameters:
      context - the context to parse the message within.
      requestedParsers - an array of Class types representing the parsers to request.
      Returns:
      a Component representing the parsed message after applying the selected parsers.