Paper/CraftBukkit-Patches/0151-Remove-uneeded-validation.patch
Zach Brown 1c49ff69f4 Update Spigot's Patches round 2?
The hell happened here.
:
Fix Build 2339ac14a8e
Regen the patches 89d3fcbdfaf

This new system breaks a lot :(
2014-11-28 18:06:26 -06:00

39 lines
1.4 KiB
Diff

From 3bc8ab9a6d7f6039bc8d0286f26173db8ac61e37 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 e4ddece..18d7c96 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -509,7 +509,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;
}
@@ -600,7 +600,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