mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 22:45:31 +01:00
Fix CraftMetaItem#addAttributeModifier duplication check (#9995)
This commit is contained in:
parent
3766afadd5
commit
40872ece07
1 changed files with 19 additions and 0 deletions
|
@ -0,0 +1,19 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: hyper1423 <backup8822@gmail.com>
|
||||
Date: Sun, 3 Dec 2023 07:38:09 +0900
|
||||
Subject: [PATCH] Fix CraftMetaItem#getAttributeModifier duplication check
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index 9105c420c0c8d2285f5f45c184d54e9a5c5fbc57..21702c14986f6dedd37326ddc74245b9e493a715 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -1175,7 +1175,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
Preconditions.checkNotNull(modifier, "AttributeModifier cannot be null");
|
||||
this.checkAttributeList();
|
||||
for (Map.Entry<Attribute, AttributeModifier> entry : this.attributeModifiers.entries()) {
|
||||
- Preconditions.checkArgument(!entry.getValue().getUniqueId().equals(modifier.getUniqueId()), "Cannot register AttributeModifier. Modifier is already applied! %s", modifier);
|
||||
+ Preconditions.checkArgument(!(entry.getValue().getUniqueId().equals(modifier.getUniqueId()) && entry.getKey() == attribute), "Cannot register AttributeModifier. Modifier is already applied! %s", modifier); // Paper
|
||||
}
|
||||
return this.attributeModifiers.put(attribute, modifier);
|
||||
}
|
Loading…
Reference in a new issue