PaperSpigot-Parent/CraftBukkit-Patches/0171-Remove-uneeded-validation.patch
Zach Brown f7bb4ad8a3 Update from upstream SpigotMC
Included Commits:
Update IRC channel to irc.spi.gt SpigotMC/Spigot@a791c555e7
Remove inv close patch for now SpigotMC/Spigot@a3abb3bea9
Limit TNT Detonations per tick SpigotMC/Spigot@8f9c601aed
Use sane default config values SpigotMC/Spigot@1cbbb9b62e

These commits were not included as they were quickly reverted:
Only close if we are actually placing a block SpigotMC/Spigot@ea0b1b2d67
Revert for the above SpigotMC/Spigot@28faa0bd20
Add isUnbreakable and setUnbreakable to ItemMeta. Also fixes a bug wh... SpigotMC/Spigot@32e6d74a5f
Revert for the above SpigotMC/Spigot@4b5a26b11c
2014-08-24 02:40:45 -05:00

39 lines
1.4 KiB
Diff

From a401f5a0a27c9beaebfd02a1bc214fa50118c2f9 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 bcde85c..adaac09 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() {
--
1.9.1