Fix HIDE_ENCHANTS flag in items without enchantments

By: Doc <nachito94@msn.com>
This commit is contained in:
CraftBukkit/Spigot 2024-10-07 14:16:09 -03:00
parent f77cb8d6c2
commit 7be855108f

View file

@ -909,8 +909,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
ItemEnchantments.a list = new ItemEnchantments.a(ItemEnchantments.EMPTY);
for (Map.Entry<Enchantment, Integer> entry : enchantments.entrySet()) {
list.set(CraftEnchantment.bukkitToMinecraftHolder(entry.getKey()), entry.getValue());
if (enchantments != null) {
for (Map.Entry<Enchantment, Integer> entry : enchantments.entrySet()) {
list.set(CraftEnchantment.bukkitToMinecraftHolder(entry.getKey()), entry.getValue());
}
}
list.showInTooltip = !hasItemFlag(itemFlag);