2015-06-08 23:16:01 +00:00
|
|
|
From 3b912fcf47b7e4ced2ee16895b4541171622d74e 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
|
2015-06-08 23:16:01 +00:00
|
|
|
index 3940b5e..7b0e9a5 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
|
2015-04-16 10:19:45 +00:00
|
|
|
@@ -239,7 +239,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
|
2015-01-30 09:36:43 +00:00
|
|
|
this.lore = new ArrayList<String>(meta.lore);
|
|
|
|
}
|
|
|
|
|
|
|
|
- if (meta.hasEnchants()) {
|
|
|
|
+ if (meta.enchantments != null) { // Spigot
|
|
|
|
this.enchantments = new HashMap<Enchantment, Integer>(meta.enchantments);
|
|
|
|
}
|
|
|
|
|
2015-06-08 23:16:01 +00:00
|
|
|
@@ -572,7 +572,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;
|
|
|
|
}
|
|
|
|
|
2015-06-08 23:16:01 +00:00
|
|
|
@@ -659,7 +659,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() {
|
|
|
|
--
|
2015-05-09 20:23:26 +00:00
|
|
|
2.1.4
|
2014-08-17 21:47:36 +00:00
|
|
|
|