summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2018-07-24 08:57:17 +1000
committermd_5 <git@md-5.net>2018-07-24 08:57:17 +1000
commit0f4e33e9c7a5b3fc9912c67265b725db43fc92cb (patch)
tree99265f8d2a3caa60694d1d35e48bff190bf9c96c
parentb7b10ad1c3cd0c03c041e2958a37895ce6990f65 (diff)
downloadbukkit-0f4e33e9c7a5b3fc9912c67265b725db43fc92cb.tar
bukkit-0f4e33e9c7a5b3fc9912c67265b725db43fc92cb.tar.gz
bukkit-0f4e33e9c7a5b3fc9912c67265b725db43fc92cb.tar.lz
bukkit-0f4e33e9c7a5b3fc9912c67265b725db43fc92cb.tar.xz
bukkit-0f4e33e9c7a5b3fc9912c67265b725db43fc92cb.zip
SPIGOT-4122: Fix an instance of legacy item inequalities
-rw-r--r--src/main/java/org/bukkit/inventory/ItemStack.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 73f79b22..41a43053 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -254,7 +254,8 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
if (stack == this) {
return true;
}
- return getType()== stack.getType()&& getDurability() == stack.getDurability() && hasItemMeta() == stack.hasItemMeta() && (hasItemMeta() ? Bukkit.getItemFactory().equals(getItemMeta(), stack.getItemMeta()) : true);
+ Material comparisonType = Bukkit.getUnsafe().fromLegacy(this.getType()); // This may be called from legacy item stacks, try to get the right material
+ return comparisonType == stack.getType() && getDurability() == stack.getDurability() && hasItemMeta() == stack.hasItemMeta() && (hasItemMeta() ? Bukkit.getItemFactory().equals(getItemMeta(), stack.getItemMeta()) : true);
}
@Override