diff --git a/patches/api/Adventure.patch b/patches/api/Adventure.patch index 6766221f3f..a40462a961 100644 --- a/patches/api/Adventure.patch +++ b/patches/api/Adventure.patch @@ -390,6 +390,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; +import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; ++import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer; +import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; +import org.bukkit.Bukkit; +import org.jetbrains.annotations.NotNull; @@ -418,13 +419,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + *

Implementations may provide a serializer capable of processing any + * information that requires access to implementation details.

+ * ++ * @deprecated will be removed in adventure 5.0.0, use {@link #plainTextSerializer()} + * @return a serializer to plain text + */ -+ public static @NotNull PlainTextComponentSerializer plainSerializer() { ++ @Deprecated ++ public static @NotNull PlainComponentSerializer plainSerializer() { + return Bukkit.getUnsafe().plainComponentSerializer(); + } + + /** ++ * Get a serializer for {@link Component}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.

++ * ++ * @return a serializer to plain text ++ */ ++ public static @NotNull PlainTextComponentSerializer plainTextSerializer() { ++ return Bukkit.getUnsafe().plainTextSerializer(); ++ } ++ ++ /** + * Get a serializer for {@link Component}s that will convert to and from the + * standard JSON serialization format using Gson. + * @@ -1095,7 +1111,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public interface UnsafeValues { + // Paper start + net.kyori.adventure.text.flattener.ComponentFlattener componentFlattener(); -+ net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer plainComponentSerializer(); ++ net.kyori.adventure.text.serializer.plain.PlainComponentSerializer plainComponentSerializer(); ++ net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer plainTextSerializer(); + net.kyori.adventure.text.serializer.gson.GsonComponentSerializer gsonComponentSerializer(); + net.kyori.adventure.text.serializer.gson.GsonComponentSerializer colorDownsamplingGsonComponentSerializer(); + net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer legacyComponentSerializer(); diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index beb1d4ed54..a3cb2808f5 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -527,6 +527,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import net.kyori.adventure.text.format.TextColor; +import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; +import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; ++import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer; +import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; +import net.kyori.adventure.translation.GlobalTranslator; +import net.kyori.adventure.translation.TranslationRegistry; @@ -599,6 +600,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + }) + .build(); + public static final LegacyComponentSerializer LEGACY_SECTION_UXRC = LegacyComponentSerializer.builder().flattener(FLATTENER).hexColors().useUnusualXRepeatedCharacterHexFormat().build(); ++ public static final PlainComponentSerializer PLAIN_COMPONENT = PlainComponentSerializer.builder().flattener(FLATTENER).build(); + public static final PlainTextComponentSerializer PLAIN = PlainTextComponentSerializer.builder().flattener(FLATTENER).build(); + public static final GsonComponentSerializer GSON = GsonComponentSerializer.builder() + .legacyHoverEventSerializer(NBTLegacyHoverEventSerializer.INSTANCE) @@ -3547,7 +3549,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + @Override -+ public net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer plainComponentSerializer() { ++ public net.kyori.adventure.text.serializer.plain.PlainComponentSerializer plainComponentSerializer() { ++ return io.papermc.paper.adventure.PaperAdventure.PLAIN_COMPONENT; ++ } ++ ++ @Override ++ public net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer plainTextSerializer() { + return io.papermc.paper.adventure.PaperAdventure.PLAIN; + } +