From 8d4decb5906c01538dbc90dcb4e40a0f0040afe2 Mon Sep 17 00:00:00 2001 From: Bjarne Koll Date: Tue, 18 Jun 2024 11:11:14 +0200 Subject: [PATCH] Correct duplicate attribute check (#10901) Brackets got lost during the update, leading to an incorrect precondition call. --- .../Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch | 2 +- patches/server/General-ItemMeta-fixes.patch | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/server/Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch b/patches/server/Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch index 56a52de2d5..e754012f51 100644 --- a/patches/server/Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch +++ b/patches/server/Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.checkAttributeList(); for (Map.Entry entry : this.attributeModifiers.entries()) { - Preconditions.checkArgument(!entry.getValue().getKey().equals(modifier.getKey()), "Cannot register AttributeModifier. Modifier is already applied! %s", modifier); -+ Preconditions.checkArgument(!entry.getValue().getKey().equals(modifier.getKey()) && entry.getKey() == attribute, "Cannot register AttributeModifier. Modifier is already applied! %s", modifier); // Paper - attribute modifiers with same namespaced key but on different attributes are fine ++ Preconditions.checkArgument(!(entry.getValue().getKey().equals(modifier.getKey()) && entry.getKey() == attribute), "Cannot register AttributeModifier. Modifier is already applied! %s", modifier); // Paper - attribute modifiers with same namespaced key but on different attributes are fine } return this.attributeModifiers.put(attribute, modifier); } diff --git a/patches/server/General-ItemMeta-fixes.patch b/patches/server/General-ItemMeta-fixes.patch index bf6e3c7701..f09f3aaf92 100644 --- a/patches/server/General-ItemMeta-fixes.patch +++ b/patches/server/General-ItemMeta-fixes.patch @@ -982,7 +982,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - this.checkAttributeList(); + if (this.attributeModifiers != null) { // Paper for (Map.Entry entry : this.attributeModifiers.entries()) { - Preconditions.checkArgument(!entry.getValue().getKey().equals(modifier.getKey()) && entry.getKey() == attribute, "Cannot register AttributeModifier. Modifier is already applied! %s", modifier); // Paper - attribute modifiers with same namespaced key but on different attributes are fine + Preconditions.checkArgument(!(entry.getValue().getKey().equals(modifier.getKey()) && entry.getKey() == attribute), "Cannot register AttributeModifier. Modifier is already applied! %s", modifier); // Paper - attribute modifiers with same namespaced key but on different attributes are fine } + } // Paper + this.checkAttributeList(); // Paper - moved down