mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 08:56:23 +01:00
SPIGOT-4122: Fix an instance of legacy item inequalities
This commit is contained in:
parent
38adf52b28
commit
ea7b61290a
2 changed files with 7 additions and 1 deletions
|
@ -22,6 +22,7 @@ import org.bukkit.material.MaterialData;
|
|||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.bukkit.craftbukkit.enchantments.CraftEnchantment;
|
||||
import org.bukkit.craftbukkit.util.CraftLegacy;
|
||||
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
|
||||
@DelegateDeserialization(ItemStack.class)
|
||||
|
@ -545,7 +546,8 @@ public final class CraftItemStack extends ItemStack {
|
|||
if (handle == null || that.handle == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(that.getType() == getType() && getDurability() == that.getDurability())) {
|
||||
Material comparisonType = CraftLegacy.fromLegacy(that.getType()); // This may be called from legacy item stacks, try to get the right material
|
||||
if (!(comparisonType == getType() && getDurability() == that.getDurability())) {
|
||||
return false;
|
||||
}
|
||||
return hasItemMeta() ? that.hasItemMeta() && handle.getTag().equals(that.handle.getTag()) : !that.hasItemMeta();
|
||||
|
|
|
@ -147,6 +147,10 @@ public class CraftLegacy {
|
|||
}
|
||||
|
||||
public static Material fromLegacy(Material material) {
|
||||
if (material == null || !material.isLegacy()) {
|
||||
return material;
|
||||
}
|
||||
|
||||
return fromLegacy(new MaterialData(material));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue