Fix Cannot be adventure component serialized when the legacy component is null (#5754)
This commit is contained in:
parent
afb0748a2c
commit
3673d6758e
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c60457e9240c33a4721b82a00cef081fb320c8a7
|
||||
index 0000000000000000000000000000000000000000..7b14b3c2486f03778d4673cf9684aa576dc2724a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
|
||||
@@ -0,0 +1,344 @@
|
||||
|
@ -606,7 +606,7 @@ index 0000000000000000000000000000000000000000..c60457e9240c33a4721b82a00cef081f
|
|||
+ // 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) {
|
||||
|
|
Loading…
Reference in a new issue