Class TextPlaceholder
java.lang.Object
com.kamikazejam.kamicommon.nms.text.TextPlaceholder
A MiniMessage tag replacement, expressed as data rather than as a wrapped Adventure resolver.
Pass these to VersionedComponentSerializer#fromMiniMessage(String, TextPlaceholder...).
The versions/* module converts them into whichever resolver its server needs, which is the
point: this class deliberately holds no Adventure type. Wrapping a TagResolver here
would be more convenient and would move the leak rather than close it, invisibly, because the field
would be private.
The three factories mirror the three Adventure offers: an unparsed literal, a nested MiniMessage string, and an already-built component.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhich of the three forms a placeholder carries. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull TextPlaceholdercomponent(@NotNull String key, @NotNull VersionedComponent value) A replacement that is an already-built component, so it can carry its own click and hover behaviour.@Nullable VersionedComponentThe component value forTextPlaceholder.Kind.COMPONENT, elsenull.@NotNull StringgetKey()The tag name, without angle brackets.@NotNull TextPlaceholder.KindgetKind()Which form this placeholder carries.@Nullable Stringstatic @NotNull TextPlaceholderA replacement inserted verbatim.static @NotNull TextPlaceholderminiMessage(@NotNull String key, @NotNull String value) A replacement parsed as MiniMessage before insertion.@NotNull StringtoString()
-
Method Details
-
literal
@NotNull public static @NotNull TextPlaceholder literal(@NotNull @NotNull String key, @NotNull @NotNull String value) A replacement inserted verbatim. MiniMessage syntax insidevalueis not interpreted, which is what you want for anything user-supplied.- Parameters:
key- the tag name, without angle brackets
-
miniMessage
@NotNull public static @NotNull TextPlaceholder miniMessage(@NotNull @NotNull String key, @NotNull @NotNull String value) A replacement parsed as MiniMessage before insertion.- Parameters:
key- the tag name, without angle brackets
-
component
@NotNull public static @NotNull TextPlaceholder component(@NotNull @NotNull String key, @NotNull @NotNull VersionedComponent value) A replacement that is an already-built component, so it can carry its own click and hover behaviour. This is the form that replaces reaching throughVersionedComponent#asInternalComponent()to build an AdventurePlaceholder.- Parameters:
key- the tag name, without angle brackets
-
getKey
The tag name, without angle brackets. -
getKind
Which form this placeholder carries. -
getStringValue
-
getComponentValue
The component value forTextPlaceholder.Kind.COMPONENT, elsenull. -
toString
-