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 Summary
Modifier and TypeMethodDescriptionparse(SocialParserContext context) Parses the givenSocialParserContextand returns aComponentrepresentation.static Componentrequest(@NotNull SocialParserContext context, @NotNull Class<?>... requestedParsers) Processes a list of parsers provided by their class types, retrieving the first available parser from theSocialinstance'sTextProcessor.static ComponentrequestList(@NotNull SocialParserContext context, @NotNull List<? extends SocialContextualParser> requestedParsers) Processes a list of parsers in sequence, applying each parser to the givenSocialParserContext.default booleanChecks if this parser supports offline players.
-
Method Details
-
parse
Parses the givenSocialParserContextand returns aComponentrepresentation.- 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
Componentrepresenting the parsed message.
-
supportsOfflinePlayers
default boolean supportsOfflinePlayers()Checks if this parser supports offline players. The default implementation returnsfalse, but can be overridden by implementations that need to handle offline players.- Returns:
trueif the parser supports offline players, otherwisefalse.
-
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 givenSocialParserContext.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
Componentrepresenting 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 theSocialinstance'sTextProcessor. This allows parsing to be performed based on specific parser types passed as class references.
-