Package io.papermc.paper.text
Class PaperComponents
java.lang.Object
io.papermc.paper.text.PaperComponents
Paper API-specific methods for working with
Component
s and related.-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull GsonComponentSerializer
Get a serializer forComponent
s that will convert to and from the standard JSON serialization format using Gson, downsampling any RGB colors to their nearestNamedTextColor
counterpart.static @NonNull ComponentFlattener
Return a component flattener that can use game data to resolve extra information about components.static @NonNull GsonComponentSerializer
Get a serializer forComponent
s that will convert to and from the standard JSON serialization format using Gson.static @NonNull LegacyComponentSerializer
Get a serializer forComponent
s that will convert to and from the legacy component format used by Bukkit.static @NonNull PlainComponentSerializer
Get a serializer forComponent
s that will convert components to a plain-text string.
-
Method Details
-
flattener
Return a component flattener that can use game data to resolve extra information about components.- Returns:
- a component flattener
-
plainSerializer
Get a serializer forComponent
s that will convert components to a plain-text string.Implementations may provide a serializer capable of processing any information that requires access to implementation details.
- Returns:
- a serializer to plain text
-
gsonSerializer
Get a serializer forComponent
s that will convert to and from the standard JSON serialization format using Gson.Implementations may provide a serializer capable of processing any information that requires implementation details, such as legacy (pre-1.16) hover events.
- Returns:
- a json component serializer
-
colorDownsamplingGsonSerializer
Get a serializer forComponent
s that will convert to and from the standard JSON serialization format using Gson, downsampling any RGB colors to their nearestNamedTextColor
counterpart.Implementations may provide a serializer capable of processing any information that requires implementation details, such as legacy (pre-1.16) hover events.
- Returns:
- a json component serializer
-
legacySectionSerializer
Get a serializer forComponent
s that will convert to and from the legacy component format used by Bukkit. This serializer uses theLegacyComponentSerializer.Builder.useUnusualXRepeatedCharacterHexFormat()
option to match upstream behavior.This legacy serializer uses the standard section symbol to mark formatting characters.
Implementations may provide a serializer capable of processing any information that requires access to implementation details.
- Returns:
- a section serializer
-