2015-01-05 03:32:01 +00:00
|
|
|
From a891dafd04483eed0eb8a093651f1aba00120547 Mon Sep 17 00:00:00 2001
|
2014-08-17 21:47:36 +00:00
|
|
|
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
|
2014-12-18 23:33:08 +00:00
|
|
|
index 3a87cb7..070b23a 100644
|
2014-08-17 21:47:36 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
2014-12-18 23:33:08 +00:00
|
|
|
@@ -531,7 +531,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
|
2014-08-17 21:47:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2014-12-18 23:33:08 +00:00
|
|
|
@@ -622,7 +622,14 @@ class CraftMetaItem implements ItemMeta, Repairable {
|
2014-08-17 21:47:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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() {
|
|
|
|
--
|
2014-11-28 01:17:45 +00:00
|
|
|
2.1.0
|
2014-08-17 21:47:36 +00:00
|
|
|
|