distinguish between null and empty map in API (#10829)

This commit is contained in:
Jake Potrebic
2024-07-16 11:36:07 -07:00
parent ad2de918bf
commit 2a8b311dfb
2 changed files with 27 additions and 1 deletions

View File

@@ -954,7 +954,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.attributeModifiers.put(attribute, modifier);
}
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@Override
public void setAttributeModifiers(@Nullable Multimap<Attribute, AttributeModifier> attributeModifiers) {
- if (attributeModifiers == null || attributeModifiers.isEmpty()) {
+ // Paper start - distinguish between null and empty
+ if (attributeModifiers == null) {
+ this.attributeModifiers = null;
+ return;
+ }
+ if (attributeModifiers.isEmpty()) {
+ // Paper end - distinguish between null and empty
this.attributeModifiers = LinkedHashMultimap.create();
return;
}