mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 03:22:19 +01:00
SPIGOT-4330: Improve isSimilar for legacy stacks
By: md_5 <git@md-5.net>
This commit is contained in:
parent
6ea05f1541
commit
7c0a97e876
1 changed files with 3 additions and 1 deletions
|
@ -120,6 +120,8 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
|
|||
}
|
||||
if (type.isLegacy()) {
|
||||
createData((byte) 0);
|
||||
} else {
|
||||
this.data = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -263,7 +265,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
|
|||
if (stack == this) {
|
||||
return true;
|
||||
}
|
||||
Material comparisonType = Bukkit.getUnsafe().fromLegacy(this.getType()); // This may be called from legacy item stacks, try to get the right material
|
||||
Material comparisonType = (this.type.isLegacy()) ? Bukkit.getUnsafe().fromLegacy(this.getData(), true) : this.type; // 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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue