geforkt von Mirrors/Paper
74110558b2
81e4ab71ca4 b023457499d dc776bee32b 116e6fc98dc 2b97a3846f2
39 Zeilen
1.4 KiB
Diff
39 Zeilen
1.4 KiB
Diff
From 5f7fe70ea4af2e1d88a18470ad373e5fd5408067 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 b42baa9..d6e4023 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
@@ -512,7 +512,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;
|
|
}
|
|
|
|
@@ -603,7 +603,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
|
|
|