2015-04-09 05:18:56 +02:00
|
|
|
From 98e40a66764d6b66776de1bd5c8ec334c24f1311 Mon Sep 17 00:00:00 2001
|
2014-08-17 23:47:36 +02: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-03-24 21:45:15 +01:00
|
|
|
index bf5edf8..60c4bad 100644
|
2014-08-17 23:47:36 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
2015-03-24 21:45:15 +01:00
|
|
|
@@ -237,7 +237,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
|
2015-01-30 10:36:43 +01: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-03-24 21:45:15 +01:00
|
|
|
@@ -559,7 +559,7 @@ class CraftMetaItem implements ItemMeta, Repairable {
|
2014-08-17 23:47:36 +02: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-03-24 21:45:15 +01:00
|
|
|
@@ -650,7 +650,14 @@ class CraftMetaItem implements ItemMeta, Repairable {
|
2014-08-17 23:47:36 +02: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 02:17:45 +01:00
|
|
|
2.1.0
|
2014-08-17 23:47:36 +02:00
|
|
|
|