3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 11:00:06 +01:00

Fix Cannot be adventure component serialized when the legacy component is null (#5754)

Dieser Commit ist enthalten in:
LemonCaramel 2021-06-05 16:49:04 +09:00 committet von GitHub
Ursprung afb0748a2c
Commit 3673d6758e
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -475,7 +475,7 @@ index 0000000000000000000000000000000000000000..caa9708f321f04cd02534161231c0599
+} +}
diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..c60457e9240c33a4721b82a00cef081fb320c8a7 index 0000000000000000000000000000000000000000..7b14b3c2486f03778d4673cf9684aa576dc2724a
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java +++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
@@ -0,0 +1,344 @@ @@ -0,0 +1,344 @@
@ -606,7 +606,7 @@ index 0000000000000000000000000000000000000000..c60457e9240c33a4721b82a00cef081f
+ // Component + // Component
+ +
+ public static Component asAdventure(final IChatBaseComponent component) { + public static Component asAdventure(final IChatBaseComponent component) {
+ return GSON.serializer().fromJson(IChatBaseComponent.ChatSerializer.toJsonTree(component), Component.class); + return component == null ? Component.empty() : GSON.serializer().fromJson(IChatBaseComponent.ChatSerializer.toJsonTree(component), Component.class);
+ } + }
+ +
+ public static ArrayList<Component> asAdventure(final List<IChatBaseComponent> vanillas) { + public static ArrayList<Component> asAdventure(final List<IChatBaseComponent> vanillas) {