diff --git a/CraftBukkit-Patches/0126-Better-item-validation.patch b/CraftBukkit-Patches/0126-Better-item-validation.patch index 1bee19654..689935003 100644 --- a/CraftBukkit-Patches/0126-Better-item-validation.patch +++ b/CraftBukkit-Patches/0126-Better-item-validation.patch @@ -76,9 +76,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +// Spigot end + @DelegateDeserialization(SerializableMeta.class) - class CraftMetaBook extends CraftMetaItem implements BookMeta { + public class CraftMetaBook extends CraftMetaItem implements BookMeta { static final ItemMetaKey BOOK_TITLE = new ItemMetaKey("title"); -@@ -0,0 +0,0 @@ class CraftMetaBook extends CraftMetaItem implements BookMeta { +@@ -0,0 +0,0 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { super(tag); if (tag.hasKey(BOOK_TITLE.NBT)) { @@ -92,7 +92,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } boolean resolved = false; -@@ -0,0 +0,0 @@ class CraftMetaBook extends CraftMetaItem implements BookMeta { +@@ -0,0 +0,0 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { // Ignore and treat as an old book } } @@ -105,9 +105,9 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -0,0 +0,0 @@ import java.util.HashSet; - import java.util.Set; - import org.bukkit.block.BlockState; +@@ -0,0 +0,0 @@ import java.util.logging.Logger; + import net.minecraft.server.NBTCompressedStreamTools; + import org.apache.commons.codec.binary.Base64; +// Spigot start +import static org.spigotmc.ValidateUtils.*; diff --git a/CraftBukkit-Patches/0142-Filter-attribute-modifiers-which-cause-the-attribute.patch b/CraftBukkit-Patches/0142-Filter-attribute-modifiers-which-cause-the-attribute.patch index 5ec83aa81..64e231e35 100644 --- a/CraftBukkit-Patches/0142-Filter-attribute-modifiers-which-cause-the-attribute.patch +++ b/CraftBukkit-Patches/0142-Filter-attribute-modifiers-which-cause-the-attribute.patch @@ -9,7 +9,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -0,0 +0,0 @@ import org.bukkit.block.BlockState; +@@ -0,0 +0,0 @@ import org.apache.commons.codec.binary.Base64; // Spigot start import static org.spigotmc.ValidateUtils.*; diff --git a/CraftBukkit-Patches/0150-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch b/CraftBukkit-Patches/0150-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch index 3d03ad3be..83a28be2b 100644 --- a/CraftBukkit-Patches/0150-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch +++ b/CraftBukkit-Patches/0150-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private String displayName; private List lore; @@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { - this.attributes = meta.attributes; + this.repairCost = meta.repairCost; this.hideFlag = meta.hideFlag; this.unhandledTags.putAll(meta.unhandledTags); + spigot.setUnbreakable( meta.spigot.isUnbreakable() ); // Spigot @@ -39,10 +39,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 static Map buildEnchantments(NBTTagCompound tag, ItemMetaKey key) { @@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { - } } } -+ + + // Spigot start + Boolean unbreakable = SerializableMeta.getObject( Boolean.class, map, UNBREAKABLE.BUKKIT, true ); + if ( unbreakable != null ) @@ -50,9 +49,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + spigot.setUnbreakable( unbreakable ); + } + // Spigot end - } - - static Map buildEnchantments(Map map, ItemMetaKey key) { ++ + String internal = SerializableMeta.getString(map, "internal", true); + if (internal != null) { + ByteArrayInputStream buf = new ByteArrayInputStream(Base64.decodeBase64(internal)); @@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { } @@ -72,13 +72,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Overridden boolean isEmpty() { -- return !(hasDisplayName() || hasEnchants() || hasLore() || hasAttributes() || hasRepairCost() || !unhandledTags.isEmpty() || hideFlag != 0); -+ return !(hasDisplayName() || hasEnchants() || hasLore() || hasAttributes() || hasRepairCost() || !unhandledTags.isEmpty() || hideFlag != 0 || spigot.isUnbreakable()); // Spigot +- return !(hasDisplayName() || hasEnchants() || hasLore() || hasRepairCost() || !unhandledTags.isEmpty() || hideFlag != 0); ++ return !(hasDisplayName() || hasEnchants() || hasLore() || hasRepairCost() || !unhandledTags.isEmpty() || hideFlag != 0 || spigot.isUnbreakable()); // Spigot } public String getDisplayName() { @@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { - && (this.hasAttributes() ? that.hasAttributes() && this.attributes.equals(that.attributes) : !that.hasAttributes()) + && (this.hasLore() ? that.hasLore() && this.lore.equals(that.lore) : !that.hasLore()) && (this.hasRepairCost() ? that.hasRepairCost() && this.repairCost == that.repairCost : !that.hasRepairCost()) && (this.unhandledTags.equals(that.unhandledTags)) - && (this.hideFlag == that.hideFlag); @@ -117,7 +117,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + UNBREAKABLE.NBT, // Spigot DISPLAY.NBT, REPAIR.NBT, - ATTRIBUTES.NBT, + ENCHANTMENTS.NBT, @@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { // Spigot start private final Spigot spigot = new Spigot()