From 4f4e345db08d04567c10f3f9dab0120cf4934e97 Mon Sep 17 00:00:00 2001 From: drXor Date: Fri, 15 Aug 2014 18:11:09 -0400 Subject: [PATCH] Remove uneeded validation diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java index dbdd47d..6c4c524 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -239,7 +239,7 @@ class CraftMetaItem implements ItemMeta, Repairable { this.lore = new ArrayList(meta.lore); } - if (meta.hasEnchants()) { + if (meta.enchantments != null) { // Spigot this.enchantments = new HashMap(meta.enchantments); } @@ -573,7 +573,7 @@ class CraftMetaItem implements ItemMeta, Repairable { } static void applyEnchantments(Map enchantments, NBTTagCompound tag, ItemMetaKey key) { - if (enchantments == null || enchantments.size() == 0) { + if (enchantments == null /*|| enchantments.size() == 0*/) { // Spigot - remove size check return; } @@ -660,7 +660,14 @@ class CraftMetaItem implements ItemMeta, Repairable { } public boolean removeEnchant(Enchantment ench) { - return hasEnchants() && enchantments.remove(ench) != null; + // Spigot start + boolean b = hasEnchants() && enchantments.remove( ench ) != null; + if ( enchantments != null && enchantments.isEmpty() ) + { + this.enchantments = null; + } + return b; + // Spigot end } public boolean hasEnchants() { -- 2.1.0