From 7be855108f528cacbb40b745efa3f297f71eaab8 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Mon, 7 Oct 2024 14:16:09 -0300 Subject: [PATCH] Fix HIDE_ENCHANTS flag in items without enchantments By: Doc --- .../org/bukkit/craftbukkit/inventory/CraftMetaItem.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java index e287f02e30..22a5bc1a64 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -909,8 +909,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { ItemEnchantments.a list = new ItemEnchantments.a(ItemEnchantments.EMPTY); - for (Map.Entry entry : enchantments.entrySet()) { - list.set(CraftEnchantment.bukkitToMinecraftHolder(entry.getKey()), entry.getValue()); + if (enchantments != null) { + for (Map.Entry entry : enchantments.entrySet()) { + list.set(CraftEnchantment.bukkitToMinecraftHolder(entry.getKey()), entry.getValue()); + } } list.showInTooltip = !hasItemFlag(itemFlag);