diff options
author | Jake Potrebic <[email protected]> | 2024-05-11 09:14:16 -0700 |
---|---|---|
committer | Jake Potrebic <[email protected]> | 2024-05-11 09:14:23 -0700 |
commit | 6c02dbcfa137f40418fc56a0a85721b1fa0242ff (patch) | |
tree | 04f399fc2927bd104183b1c0655723c7e9f4affb | |
parent | a61d58d4679e1219f97fbc6a62d9d1186f56eba1 (diff) | |
download | Paper-6c02dbcfa137f40418fc56a0a85721b1fa0242ff.tar.gz Paper-6c02dbcfa137f40418fc56a0a85721b1fa0242ff.zip |
handle recent ItemMeta changes in serialization logic
-rw-r--r-- | patches/server/1044-General-ItemMeta-fixes.patch | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/patches/server/1044-General-ItemMeta-fixes.patch b/patches/server/1044-General-ItemMeta-fixes.patch index a8c0ab60dd..d05a17dbe7 100644 --- a/patches/server/1044-General-ItemMeta-fixes.patch +++ b/patches/server/1044-General-ItemMeta-fixes.patch @@ -260,7 +260,7 @@ index 8e0dd4b7a7a25a8beb27b507047bc48d8227627c..cf5d27ccc2225bac3aa57912f444f95d @Override diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 0bc100430483f88bc7edf17645250b2862ccc1d5..c81d8e09c6f6ac4cec9cd57e9af41a9a60b24bb1 100644 +index 0bc100430483f88bc7edf17645250b2862ccc1d5..db3e74f22f555e3bb5b304af303cdd46a5377894 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -165,9 +165,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -296,6 +296,15 @@ index 0bc100430483f88bc7edf17645250b2862ccc1d5..c81d8e09c6f6ac4cec9cd57e9af41a9a CraftMetaItem.getOrEmpty(tag, CraftMetaItem.NAME).ifPresent((component) -> { this.displayName = component; }); +@@ -725,7 +731,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { + Map<?, ?> mods = SerializableMeta.getObject(Map.class, map, key.BUKKIT, true); + Multimap<Attribute, AttributeModifier> result = LinkedHashMultimap.create(); + if (mods == null) { +- return result; ++ return null; // Paper - null is different from an empty map + } + + for (Object obj : mods.keySet()) { @@ -879,10 +885,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { } @@ -386,6 +395,15 @@ index 0bc100430483f88bc7edf17645250b2862ccc1d5..c81d8e09c6f6ac4cec9cd57e9af41a9a clone.attributeModifiers = LinkedHashMultimap.create(this.attributeModifiers); } if (this.customTag != null) { +@@ -1787,7 +1795,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { + } + + static void serializeModifiers(Multimap<Attribute, AttributeModifier> modifiers, ImmutableMap.Builder<String, Object> builder, ItemMetaKey key) { +- if (modifiers == null || modifiers.isEmpty()) { ++ if (modifiers == null/* || modifiers.isEmpty()*/) { // Paper - null and an empty map have different behaviors + return; + } + @@ -1869,7 +1877,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { // Paper start - improve checking handled tags @org.jetbrains.annotations.VisibleForTesting |