Class PaperComponents
Components and related.-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull GsonComponentSerializerDeprecated, for removal: This API element is subject to removal in a future version.static @NotNull ComponentFlattenerReturn a component flattener that can use game data to resolve extra information about components.static @NotNull GsonComponentSerializerDeprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.static @NotNull PlainComponentSerializerDeprecated, for removal: This API element is subject to removal in a future version.will be removed in adventure 5.0.0, usePlainTextComponentSerializer.plainText()Deprecated, for removal: This API element is subject to removal in a future version.resolveWithContext(@NotNull Component input, @Nullable CommandSender context, @Nullable Entity scoreboardSubject) Resolves a component with a specific command sender and subject.resolveWithContext(@NotNull Component input, @Nullable CommandSender context, @Nullable Entity scoreboardSubject, boolean bypassPermissions) Resolves a component with a specific command sender and subject.
-
Method Details
-
resolveWithContext
@NotNull public static @NotNull Component resolveWithContext(@NotNull @NotNull Component input, @Nullable @Nullable CommandSender context, @Nullable @Nullable Entity scoreboardSubject) throws IOException Resolves a component with a specific command sender and subject.Note that in Vanilla, elevated permissions are usually required to use '@' selectors in various component types, but this method should not check such permissions from the sender.
A
ACommandSenderargument is required to resolve:Entityargument is optional to help resolve:TranslatableComponents don't require any extra arguments.- Parameters:
input- the component to resolvecontext- the command sender to resolve withscoreboardSubject- the scoreboard subject to use (for use withScoreComponents)- Returns:
- the resolved component
- Throws:
IOException- if a syntax error tripped during resolving
-
resolveWithContext
@NotNull public static @NotNull Component resolveWithContext(@NotNull @NotNull Component input, @Nullable @Nullable CommandSender context, @Nullable @Nullable Entity scoreboardSubject, boolean bypassPermissions) throws IOException Resolves a component with a specific command sender and subject.Note that in Vanilla, elevated permissions are required to use '@' selectors in various component types. If the boolean
bypassPermissionsargument isfalse, theCommandSenderargument will be used to query those permissions.A
ACommandSenderargument is required to resolve:Entityargument is optional to help resolve:TranslatableComponents don't require any extra arguments.- Parameters:
input- the component to resolvecontext- the command sender to resolve withscoreboardSubject- the scoreboard subject to use (for use withScoreComponents)bypassPermissions- true to bypass permissions checks for resolving components- Returns:
- the resolved component
- Throws:
IOException- if a syntax error tripped during resolving
-
flattener
Return a component flattener that can use game data to resolve extra information about components.- Returns:
- a component flattener
-
plainSerializer
@Deprecated(forRemoval=true) @NotNull public static @NotNull PlainComponentSerializer plainSerializer()Deprecated, for removal: This API element is subject to removal in a future version.will be removed in adventure 5.0.0, usePlainTextComponentSerializer.plainText()Get a serializer forComponents 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
-
plainTextSerializer
@Deprecated(forRemoval=true) @NotNull public static @NotNull PlainTextComponentSerializer plainTextSerializer()Deprecated, for removal: This API element is subject to removal in a future version.Get a serializer forComponents 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
@Deprecated(forRemoval=true) @NotNull public static @NotNull GsonComponentSerializer gsonSerializer()Deprecated, for removal: This API element is subject to removal in a future version.Get a serializer forComponents 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
@Deprecated(forRemoval=true) @NotNull public static @NotNull GsonComponentSerializer colorDownsamplingGsonSerializer()Deprecated, for removal: This API element is subject to removal in a future version.Get a serializer forComponents that will convert to and from the standard JSON serialization format using Gson, downsampling any RGB colors to their nearestNamedTextColorcounterpart.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
@Deprecated(forRemoval=true) @NotNull public static @NotNull LegacyComponentSerializer legacySectionSerializer()Deprecated, for removal: This API element is subject to removal in a future version.Get a serializer forComponents 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
-
GsonComponentSerializer.colorDownsamplingGson()