Interface SocialInjectedValue<T,Self extends SocialInjectedValue<T,Self>>
- Type Parameters:
T- the type of the wrapped valueSelf- the concrete implementing subtype (F-bounded self-type)
- All Known Implementing Classes:
AbstractSocialInjectedValue,AbstractSocialInjectedValue.Identified,SocialInjectedConditionalValue,SocialInjectedLiteral,SocialInjectedObject,SocialInjectedPlaceholder,SocialInjectedTag
public interface SocialInjectedValue<T,Self extends SocialInjectedValue<T,Self>>
A typed value that can be injected into a chat format and parsed into a
Component.
The T parameter is the raw value type (e.g. TextComponent, TagResolver).
The Self parameter is the concrete subtype, used so that parser() can return a
SocialInjectionParser typed to the exact subclass without any unchecked cast.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends SocialInjectedValue<?,T>, P extends SocialInjectionParser<T>>
SocialInjectedConditionalValue<T, P> conditional(T value, P conditionalParser, @NotNull Predicate<SocialParserContext> predicate) static SocialInjectedLiteralstatic SocialInjectedLiteralliteral(@NotNull TextComponent value) Creates a newSocialInjectedLiteralwrapping aTextComponent.static SocialInjectedObjectCreates a newSocialInjectedObjectwrapping a specificObject.static SocialInjectedObjectobject(@NotNull String identifier, @NotNull Object value, @NotNull SocialInjectionEmptyParser parser) Creates a newSocialInjectedObjectwrapping a specificObject.parse(@NotNull SocialParserContext context) Parses this value into aComponentusing the provided context.parser()Returns the parser for this exact concrete type — no cast required.static SocialInjectedPlaceholderplaceholder(@NotNull String identifier, @NotNull TextComponent value) Creates a newSocialInjectedPlaceholderwith the given parameters.static SocialInjectedTagtag(@NotNull String identifier, @NotNull net.kyori.adventure.text.minimessage.tag.resolver.TagResolver value) Creates a newSocialInjectedTagwrapping aTagResolver.value()Returns the raw wrapped value.
-
Method Details
-
conditional
static <T extends SocialInjectedValue<?,T>, SocialInjectedConditionalValue<T,P extends SocialInjectionParser<T>> P> conditional(@NotNull T value, @NotNull P conditionalParser, @NotNull @NotNull Predicate<SocialParserContext> predicate) -
literal
Creates a newSocialInjectedLiteralwrapping aTextComponent.- Parameters:
value- theTextComponentto wrap- Returns:
- a
SocialInjectedLiteralwrappingvalue
-
literal
- Parameters:
valueAsString- theStringto build into aTextComponentand wrap- Returns:
- a
SocialInjectedLiteralwrappingvalue
-
object
static SocialInjectedObject object(@NotNull @NotNull String identifier, @NotNull @NotNull Object value, @NotNull @NotNull SocialInjectionEmptyParser parser) Creates a newSocialInjectedObjectwrapping a specificObject.- Parameters:
identifier- the identifier for the wrapped objectvalue- the object to wrapparser- theSocialInjectionEmptyParserto parse the wrapped object- Returns:
- a
SocialInjectedObjectwrappingvalue
-
object
static SocialInjectedObject object(@NotNull @NotNull String identifier, @NotNull @NotNull Object value) Creates a newSocialInjectedObjectwrapping a specificObject.The injected object will use the default
SocialInjectionEmptyParserimplementation.- Parameters:
identifier- the identifier for the wrapped objectvalue- the object to wrap- Returns:
- a
SocialInjectedObjectwrappingvalue
-
placeholder
static SocialInjectedPlaceholder placeholder(@NotNull @NotNull String identifier, @NotNull @NotNull TextComponent value) Creates a newSocialInjectedPlaceholderwith the given parameters.The
SocialInjectedPlaceholderwill be built into aSocialContextualPlaceholderat runtime from the given parameters.- Parameters:
identifier- the identifier for the wrapped placeholdervalue- theTextComponentthat the placeholder will return- Returns:
- a
SocialInjectedPlaceholderwrapping the placeholder
-
tag
static SocialInjectedTag tag(@NotNull @NotNull String identifier, @NotNull @NotNull net.kyori.adventure.text.minimessage.tag.resolver.TagResolver value) Creates a newSocialInjectedTagwrapping aTagResolver.- Parameters:
identifier- the identifier for the wrapped tagvalue- theTagResolverto wrap- Returns:
- a
SocialInjectedTagwrapping theTagResolver
-
value
Returns the raw wrapped value. -
parser
Returns the parser for this exact concrete type — no cast required. -
parse
Parses this value into aComponentusing the provided context.
-