Fix ABI breakage for plainSerializer (#7178)

This commit is contained in:
Josh Roy 2021-12-22 17:56:37 -05:00
parent 10610720ce
commit cc1f56d99e
2 changed files with 27 additions and 3 deletions

View file

@ -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
+ * <p>Implementations may provide a serializer capable of processing any
+ * information that requires access to implementation details.</p>
+ *
+ * @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.
+ *
+ * <p>Implementations may provide a serializer capable of processing any
+ * information that requires access to implementation details.</p>
+ *
+ * @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();

View file

@ -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;
+ }
+