From 28d993ccec1174fc5ed397edca02c50e75213865 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 26 Apr 2017 15:45:52 +1000 Subject: [PATCH] Skip invalid enchants in CraftMetaItem --- .../java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java index 0ad60e84e3..65b584488c 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -358,7 +358,10 @@ class CraftMetaItem implements ItemMeta, Repairable { int id = 0xffff & ((NBTTagCompound) ench.get(i)).getShort(ENCHANTMENTS_ID.NBT); int level = 0xffff & ((NBTTagCompound) ench.get(i)).getShort(ENCHANTMENTS_LVL.NBT); - enchantments.put(Enchantment.getById(id), level); + Enchantment enchant = Enchantment.getById(id); + if (enchant != null) { + enchantments.put(enchant, level); + } } return enchantments;