From f126de4a5abd5bb90001e5c422ecc582991ca570 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Tue, 24 Jul 2018 08:57:17 +1000 Subject: [PATCH] SPIGOT-4122: Fix an instance of legacy item inequalities By: md_5 --- paper-api/src/main/java/org/bukkit/inventory/ItemStack.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/paper-api/src/main/java/org/bukkit/inventory/ItemStack.java b/paper-api/src/main/java/org/bukkit/inventory/ItemStack.java index 73f79b222f..41a4305368 100644 --- a/paper-api/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/paper-api/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