fix NPE in getDisplayNameComponent

This commit is contained in:
Jake Potrebic 2021-01-05 10:43:26 -08:00 committed by MiniDigger | Martin
parent 24e1403721
commit fccac282aa

View file

@ -17,7 +17,7 @@ index b8770066a86df25d6ba9ecf74d846c730d228c01..2eb45e8e05b1a2ad6b8fcb204f2d2b06
return IChatBaseComponent.ChatSerializer.a.toJson(ichatbasecomponent);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 99495722455b27ba90523c6d6dfd874aa2a8b3fe..c981568c252843c5be5ebdc2554cd172f5f4b16c 100644
index 99495722455b27ba90523c6d6dfd874aa2a8b3fe..a11591aa103ea53b505a2b396dcfc0f9f01b68c0 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -861,11 +861,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@ -27,7 +27,7 @@ index 99495722455b27ba90523c6d6dfd874aa2a8b3fe..c981568c252843c5be5ebdc2554cd172
+ // Paper start
+ @Override
+ public net.md_5.bungee.api.chat.BaseComponent[] getDisplayNameComponent() {
+ return net.md_5.bungee.chat.ComponentSerializer.parse(displayName);
+ return displayName == null ? new net.md_5.bungee.api.chat.BaseComponent[0] : net.md_5.bungee.chat.ComponentSerializer.parse(displayName);
+ }
+ // Paper end
@Override