Paper/CraftBukkit-Patches/0148-Remove-uneeded-validation.patch
Zach Brown c7f1eed0bf Update from upstream SpigotMC
3beb7729816
a77ed5758a7
52c130fc6d9
2014-12-20 19:09:49 -06:00

39 lines
1.4 KiB
Diff

From 9528ffea3fedc1446d6725faf4153e5b23bb73dd Mon Sep 17 00:00:00 2001
From: drXor <mcyoung@mit.edu>
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 3a87cb7..070b23a 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -531,7 +531,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
}
static void applyEnchantments(Map<Enchantment, Integer> enchantments, NBTTagCompound tag, ItemMetaKey key) {
- if (enchantments == null || enchantments.size() == 0) {
+ if (enchantments == null /*|| enchantments.size() == 0*/) { // Spigot - remove size check
return;
}
@@ -622,7 +622,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