mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-21 18:15:54 +01:00
handle recent ItemMeta changes in serialization logic
This commit is contained in:
parent
a61d58d467
commit
6c02dbcfa1
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user