diff options
12 files changed, 149 insertions, 29 deletions
diff --git a/patches/api/0187-Add-Raw-Byte-ItemStack-Serialization.patch b/patches/api/0187-Add-Raw-Byte-ItemStack-Serialization.patch index 8035d3ac56..681f0cf021 100644 --- a/patches/api/0187-Add-Raw-Byte-ItemStack-Serialization.patch +++ b/patches/api/0187-Add-Raw-Byte-ItemStack-Serialization.patch @@ -5,6 +5,8 @@ Subject: [PATCH] Add Raw Byte ItemStack Serialization Serializes using NBT which is safer for server data migrations than bukkits format. +Co-authored-by: Nassim Jahnke <[email protected]> + diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java index da997507b96908027c49dabc6daf7c787dcad95d..cb7aef53cbffc76dea9fec28445ea8aefcb29d62 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java @@ -20,10 +22,18 @@ index da997507b96908027c49dabc6daf7c787dcad95d..cb7aef53cbffc76dea9fec28445ea8ae // Paper end } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index d758cea1d8e88937678dbfd0ac72d49b6c160fe0..066f99a1f4cc42cf0e87d495f97a0685817dfa18 100644 +index d758cea1d8e88937678dbfd0ac72d49b6c160fe0..fdc23ef0659f974efc6a3e8016da9104e2886a28 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -659,6 +659,30 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat +@@ -28,6 +28,7 @@ import org.jetbrains.annotations.Nullable; + * returns false.</b> + */ + public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowItem> { // Paper ++ private static final byte ARRAY_SERIALIZATION_VERSION = 1; // Paper + private Material type = Material.AIR; + private int amount = 0; + private MaterialData data = null; +@@ -659,6 +660,110 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat return Bukkit.getServer().getItemFactory().ensureServerConversions(this); } @@ -51,6 +61,116 @@ index d758cea1d8e88937678dbfd0ac72d49b6c160fe0..066f99a1f4cc42cf0e87d495f97a0685 + return org.bukkit.Bukkit.getUnsafe().serializeItem(this); + } + ++ /** ++ * Serializes a collection of items to raw bytes in NBT. Serializes empty items as null. ++ * <p> ++ * If you need a string representation to put into a file, you can for example use {@link java.util.Base64} encoding. ++ * ++ * @param items items to serialize ++ * @return bytes representing the items in NBT ++ * @see #serializeAsBytes() ++ */ ++ public static byte @NotNull [] serializeItemsAsBytes(java.util.@NotNull Collection<ItemStack> items) { ++ try (final java.io.ByteArrayOutputStream outputStream = new java.io.ByteArrayOutputStream()) { ++ final java.io.DataOutput output = new java.io.DataOutputStream(outputStream); ++ output.writeByte(ARRAY_SERIALIZATION_VERSION); ++ output.writeInt(items.size()); ++ for (final ItemStack item : items) { ++ if (item == null || item.isEmpty()) { ++ // Ensure the correct order by including empty/null items ++ output.writeInt(0); ++ continue; ++ } ++ ++ final byte[] itemBytes = item.serializeAsBytes(); ++ output.writeInt(itemBytes.length); ++ output.write(itemBytes); ++ } ++ return outputStream.toByteArray(); ++ } catch (final java.io.IOException e) { ++ throw new RuntimeException("Error while writing itemstack", e); ++ } ++ } ++ ++ /** ++ * Serializes a collection of items to raw bytes in NBT. Serializes empty items as null. ++ * <p> ++ * If you need a string representation to put into a file, you can for example use {@link java.util.Base64} encoding. ++ * ++ * @param items items to serialize ++ * @return bytes representing the items in NBT ++ * @see #serializeAsBytes() ++ */ ++ public static byte @NotNull [] serializeItemsAsBytes(@Nullable ItemStack @NotNull [] items) { ++ return serializeItemsAsBytes(java.util.Arrays.asList(items)); ++ } ++ ++ /** ++ * Deserializes this itemstack from raw NBT bytes. ++ * <p> ++ * If you need a string representation to put into a file, you can for example use {@link java.util.Base64} encoding. ++ * ++ * @param bytes bytes representing an item in NBT ++ * @return ItemStack array migrated to this version of Minecraft if needed ++ * @see #deserializeBytes(byte[]) ++ */ ++ public static @Nullable ItemStack @NotNull [] deserializeItemsFromBytes(final byte @NotNull [] bytes) { ++ try (final java.io.ByteArrayInputStream inputStream = new java.io.ByteArrayInputStream(bytes)) { ++ final java.io.DataInputStream input = new java.io.DataInputStream(inputStream); ++ final byte version = input.readByte(); ++ if (version != ARRAY_SERIALIZATION_VERSION) { ++ throw new IllegalArgumentException("Unsupported version or bad data: " + version); ++ } ++ ++ final int count = input.readInt(); ++ final ItemStack[] items = new ItemStack[count]; ++ for (int i = 0; i < count; i++) { ++ final int length = input.readInt(); ++ if (length == 0) { ++ // Empty item, keep entry as null ++ continue; ++ } ++ ++ final byte[] itemBytes = new byte[length]; ++ input.read(itemBytes); ++ items[i] = ItemStack.deserializeBytes(itemBytes); ++ } ++ return items; ++ } catch (final java.io.IOException e) { ++ throw new RuntimeException("Error while reading itemstack", e); ++ } ++ } ++ /** * Gets the Display name as seen in the Client. * Currently the server only supports the English language. To override this, +diff --git a/src/main/java/org/bukkit/util/io/BukkitObjectInputStream.java b/src/main/java/org/bukkit/util/io/BukkitObjectInputStream.java +index 0f8eb97bd5e2f8b0f0cc03f7c4342aae06c4520c..4bfdc418977be8440290510e4c324c162ddb6d94 100644 +--- a/src/main/java/org/bukkit/util/io/BukkitObjectInputStream.java ++++ b/src/main/java/org/bukkit/util/io/BukkitObjectInputStream.java +@@ -14,6 +14,9 @@ import org.bukkit.configuration.serialization.ConfigurationSerialization; + * <p> + * Behavior of implementations extending this class is not guaranteed across + * future versions. ++ * @deprecated Object streams on their own are not safe. For safer and more consistent serialization of items, ++ * use {@link org.bukkit.inventory.ItemStack#serializeAsBytes()} or ++ * {@link org.bukkit.inventory.ItemStack#serializeItemsAsBytes(java.util.Collection)}. + */ + public class BukkitObjectInputStream extends ObjectInputStream { + +diff --git a/src/main/java/org/bukkit/util/io/BukkitObjectOutputStream.java b/src/main/java/org/bukkit/util/io/BukkitObjectOutputStream.java +index dd1b9ee5f57773f07924aa311823fd8d63195cb2..c5752ae9e5653ce103ee2ba049050bfba641858c 100644 +--- a/src/main/java/org/bukkit/util/io/BukkitObjectOutputStream.java ++++ b/src/main/java/org/bukkit/util/io/BukkitObjectOutputStream.java +@@ -14,7 +14,11 @@ import org.bukkit.configuration.serialization.ConfigurationSerializable; + * <p> + * Behavior of implementations extending this class is not guaranteed across + * future versions. ++ * @deprecated Object streams on their own are not safe. For safer and more consistent serialization of items, ++ * use {@link org.bukkit.inventory.ItemStack#serializeAsBytes()} or ++ * {@link org.bukkit.inventory.ItemStack#serializeItemsAsBytes(java.util.Collection)}. + */ ++@Deprecated // Paper + public class BukkitObjectOutputStream extends ObjectOutputStream { + + /** diff --git a/patches/api/0207-Add-methods-to-get-translation-keys.patch b/patches/api/0207-Add-methods-to-get-translation-keys.patch index 8c3241281f..6c94db02dd 100644 --- a/patches/api/0207-Add-methods-to-get-translation-keys.patch +++ b/patches/api/0207-Add-methods-to-get-translation-keys.patch @@ -144,7 +144,7 @@ index dc66bd69646ac949d1386ce8f6ff913e9475439d..4482e8f2c617c2f51b2b53762e775d11 + // Paper end } diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index feebabf946913263461e1d0f13a478cf4bfd0f68..ebf505bbdc1b44d1fcd3c30f4143f6e5b89d09e9 100644 +index 7458278ad620d534b205438062327463caaa9bfc..9dfa9236f9689faa275d4a9f6b8018c824b20492 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java @@ -129,7 +129,7 @@ import org.jetbrains.annotations.Nullable; @@ -509,7 +509,7 @@ index 5bd252c0ae3b09fe141d131360c67bb9bfbf5422..78587d9fabe6371a23a7963917b054db + } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 066f99a1f4cc42cf0e87d495f97a0685817dfa18..23686519b8c1338dd6e9f1c5a0e73467c0b59a4f 100644 +index fdc23ef0659f974efc6a3e8016da9104e2886a28..f90b588e1a4f48ed8bf7f8a391b49bbd4bfb4e9a 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java @@ -27,7 +27,7 @@ import org.jetbrains.annotations.Nullable; @@ -518,10 +518,10 @@ index 066f99a1f4cc42cf0e87d495f97a0685817dfa18..23686519b8c1338dd6e9f1c5a0e73467 */ -public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowItem> { // Paper +public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowItem>, net.kyori.adventure.translation.Translatable { // Paper + private static final byte ARRAY_SERIALIZATION_VERSION = 1; // Paper private Material type = Material.AIR; private int amount = 0; - private MaterialData data = null; -@@ -626,6 +626,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat +@@ -627,6 +627,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat @Override @NotNull @@ -529,7 +529,7 @@ index 066f99a1f4cc42cf0e87d495f97a0685817dfa18..23686519b8c1338dd6e9f1c5a0e73467 public String getTranslationKey() { return Bukkit.getUnsafe().getTranslationKey(this); } -@@ -885,5 +886,16 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat +@@ -966,5 +967,16 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat ItemMeta itemMeta = getItemMeta(); return itemMeta != null && itemMeta.hasItemFlag(flag); } diff --git a/patches/api/0259-Improve-Item-Rarity-API.patch b/patches/api/0259-Improve-Item-Rarity-API.patch index bef6de4e65..a301910f04 100644 --- a/patches/api/0259-Improve-Item-Rarity-API.patch +++ b/patches/api/0259-Improve-Item-Rarity-API.patch @@ -43,7 +43,7 @@ index 0000000000000000000000000000000000000000..f1cd5a4f37eee8975ac3d0421b524afc + } +} diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index ebf505bbdc1b44d1fcd3c30f4143f6e5b89d09e9..04cb8279f2296cc42405355c7c1f120e761202c4 100644 +index 9dfa9236f9689faa275d4a9f6b8018c824b20492..9050d986b75482b5884a206f0980d1a23680001c 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java @@ -4756,6 +4756,21 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla @@ -110,10 +110,10 @@ index e7931f73f10fe35ebd5fe4a04b036d53bb117ebd..cbce835ed6d44e5b8c9aaae4e36a77f8 + // Paper end } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 23686519b8c1338dd6e9f1c5a0e73467c0b59a4f..f0221815cbd30f3ccaacc87a57403491b55de128 100644 +index f90b588e1a4f48ed8bf7f8a391b49bbd4bfb4e9a..c9964a599165d23b2a8b4041b6eba5a76e15ff81 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -897,5 +897,17 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat +@@ -978,5 +978,17 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat public @NotNull String translationKey() { return Bukkit.getUnsafe().getTranslationKey(this); } diff --git a/patches/api/0277-ItemStack-repair-check-API.patch b/patches/api/0277-ItemStack-repair-check-API.patch index 6348f33164..40c9f9884f 100644 --- a/patches/api/0277-ItemStack-repair-check-API.patch +++ b/patches/api/0277-ItemStack-repair-check-API.patch @@ -25,10 +25,10 @@ index 8635846c9f672e39f0929eec7bf83b22536ed284..51f1a09164d501de6d2561ed90175f2c // Paper end } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index f0221815cbd30f3ccaacc87a57403491b55de128..ca2dac7b377ea098158ff3c84fd47f405b636869 100644 +index c9964a599165d23b2a8b4041b6eba5a76e15ff81..6edc6f2c38f0e063929d368b37f2ce9b8422c56a 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -909,5 +909,27 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat +@@ -990,5 +990,27 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat public io.papermc.paper.inventory.ItemRarity getRarity() { return io.papermc.paper.inventory.ItemRarity.valueOf(this.getItemMeta().getRarity().name()); } diff --git a/patches/api/0280-ItemStack-editMeta.patch b/patches/api/0280-ItemStack-editMeta.patch index c1ce9b264d..d6493519a5 100644 --- a/patches/api/0280-ItemStack-editMeta.patch +++ b/patches/api/0280-ItemStack-editMeta.patch @@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack#editMeta diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index ca2dac7b377ea098158ff3c84fd47f405b636869..5fb8f7c1b79bd256925cb68cccfe0b974fb84043 100644 +index 6edc6f2c38f0e063929d368b37f2ce9b8422c56a..2e98a00627df169cb4ef6bb5c48b9d40f985f785 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -567,6 +567,50 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat +@@ -568,6 +568,50 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat return result.ensureServerConversions(); // Paper } diff --git a/patches/api/0346-Add-enchantWithLevels-API.patch b/patches/api/0346-Add-enchantWithLevels-API.patch index 7cc63d19c9..fbb05268ce 100644 --- a/patches/api/0346-Add-enchantWithLevels-API.patch +++ b/patches/api/0346-Add-enchantWithLevels-API.patch @@ -70,10 +70,10 @@ index 53b8934cb829f37971cb3ecd5652c9974dec6ab0..e20f64828548c647a29dad5a475f4596 + // Paper end - enchantWithLevels API } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 5fb8f7c1b79bd256925cb68cccfe0b974fb84043..105cf1bf6e8b44846cdd3a8881fed36007daaa22 100644 +index 2e98a00627df169cb4ef6bb5c48b9d40f985f785..8136ba4bb66969cf7043cc3b1211a87c0fc2295f 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -676,6 +676,24 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat +@@ -677,6 +677,24 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat } // Paper start diff --git a/patches/api/0382-ItemStack-damage-API.patch b/patches/api/0382-ItemStack-damage-API.patch index 6e2001f976..a9b5b451f2 100644 --- a/patches/api/0382-ItemStack-damage-API.patch +++ b/patches/api/0382-ItemStack-damage-API.patch @@ -66,10 +66,10 @@ index 6bfc8a2148f504370df938447f4f6b757f1a516b..208bab1f5a3200f54141c38ee4272629 + // Paper end - ItemStack damage API } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 105cf1bf6e8b44846cdd3a8881fed36007daaa22..ee5d2a30f634ccbe6f2cc2f82f9e56783939f5dd 100644 +index 8136ba4bb66969cf7043cc3b1211a87c0fc2295f..bbda364b1c35903cd0cec07f65ee5bf3b133880c 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -993,5 +993,19 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat +@@ -1074,5 +1074,19 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat public boolean canRepair(@NotNull ItemStack toBeRepaired) { return Bukkit.getUnsafe().isValidRepairItemStack(toBeRepaired, this); } diff --git a/patches/api/0428-Allow-proper-checking-of-empty-item-stacks.patch b/patches/api/0428-Allow-proper-checking-of-empty-item-stacks.patch index a77293644e..d0b4eb0ccb 100644 --- a/patches/api/0428-Allow-proper-checking-of-empty-item-stacks.patch +++ b/patches/api/0428-Allow-proper-checking-of-empty-item-stacks.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Allow proper checking of empty item stacks This adds a method to check if an item stack is empty or not. This mirrors vanilla's implementation of the same method. diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index ee5d2a30f634ccbe6f2cc2f82f9e56783939f5dd..e4dc17ec23d48591ff5742af5d23aa62bd9bfdbc 100644 +index bbda364b1c35903cd0cec07f65ee5bf3b133880c..980113e611ad2b7a6193fde51bf09f93309490cf 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -1007,5 +1007,24 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat +@@ -1088,5 +1088,24 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat public @NotNull ItemStack damage(int amount, @NotNull org.bukkit.entity.LivingEntity livingEntity) { return livingEntity.damageItemStack(this, amount); } diff --git a/patches/api/0436-Remove-unnecessary-durability-check-in-ItemStack-isS.patch b/patches/api/0436-Remove-unnecessary-durability-check-in-ItemStack-isS.patch index 2eed94d07c..0d32bded6e 100644 --- a/patches/api/0436-Remove-unnecessary-durability-check-in-ItemStack-isS.patch +++ b/patches/api/0436-Remove-unnecessary-durability-check-in-ItemStack-isS.patch @@ -9,10 +9,10 @@ By removing this check we avoid unnecessarily allocating useless `ItemMeta` obje This is a leftover from when checking for the item's durability was "free" because the durability was stored in the `ItemStack` itself, this [was changed in Minecraft 1.13](https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/f8b2086d60942eb2cd7ac25a2a1408cb790c222c#src/main/java/org/bukkit/inventory/ItemStack.java). diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index e4dc17ec23d48591ff5742af5d23aa62bd9bfdbc..8975f6e8004d2ed65e20bb5b71bdbfa45713f78a 100644 +index 980113e611ad2b7a6193fde51bf09f93309490cf..ea01cca310561f66be02650ceb02316490852279 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -300,7 +300,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat +@@ -301,7 +301,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat return true; } Material comparisonType = (this.type.isLegacy()) ? Bukkit.getUnsafe().fromLegacy(this.getData(), true) : this.type; // This may be called from legacy item stacks, try to get the right material diff --git a/patches/api/0452-ItemStack-Tooltip-API.patch b/patches/api/0452-ItemStack-Tooltip-API.patch index b5c800bcb4..6f91d9294b 100644 --- a/patches/api/0452-ItemStack-Tooltip-API.patch +++ b/patches/api/0452-ItemStack-Tooltip-API.patch @@ -119,10 +119,10 @@ index 3f1b48fd65df954e874e6dc6b9093cb12370e2c5..0e9ccfee7a03d341e7c4d271f53b4ed1 + @NotNull java.util.List<net.kyori.adventure.text.Component> computeTooltipLines(@NotNull ItemStack itemStack, @NotNull io.papermc.paper.inventory.tooltip.TooltipContext tooltipContext, @Nullable org.bukkit.entity.Player player); // Paper - expose itemstack tooltip lines } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 8975f6e8004d2ed65e20bb5b71bdbfa45713f78a..8db71bd075b8ece36c6f0dc0339841df9257038b 100644 +index ea01cca310561f66be02650ceb02316490852279..4ca90da610562409a5bfcd0db24a93d427f89fd5 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -1027,4 +1027,21 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat +@@ -1108,4 +1108,21 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat return type.isAir() || amount <= 0; } // Paper end diff --git a/patches/api/0462-Deprecate-ItemStack-setType.patch b/patches/api/0462-Deprecate-ItemStack-setType.patch index 8883aeb309..915577a135 100644 --- a/patches/api/0462-Deprecate-ItemStack-setType.patch +++ b/patches/api/0462-Deprecate-ItemStack-setType.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Deprecate ItemStack#setType diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 8db71bd075b8ece36c6f0dc0339841df9257038b..4818b4e6583414fa98194bb6f3c5dbd4bd95be3a 100644 +index 4ca90da610562409a5bfcd0db24a93d427f89fd5..6a7f41755b3b06ccf32802786357ce6f23d64b94 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -136,8 +136,18 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat +@@ -137,8 +137,18 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat * {@link Material#isItem()} returns false.</b> * * @param type New type to set the items in this stack to @@ -27,7 +27,7 @@ index 8db71bd075b8ece36c6f0dc0339841df9257038b..4818b4e6583414fa98194bb6f3c5dbd4 public void setType(@NotNull Material type) { Preconditions.checkArgument(type != null, "Material cannot be null"); this.type = type; -@@ -150,6 +160,24 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat +@@ -151,6 +161,24 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat this.data = null; } } diff --git a/patches/api/0468-Fix-ItemFlags.patch b/patches/api/0468-Fix-ItemFlags.patch index 989af1fc2a..1ef4609885 100644 --- a/patches/api/0468-Fix-ItemFlags.patch +++ b/patches/api/0468-Fix-ItemFlags.patch @@ -47,10 +47,10 @@ index a435f6c8947e4ac50b8c04f37b107055970937dd..92e30c281eab4801298b280bd388a039 /** * Setting to show/hide item-specific information, including, but not limited to: diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 4818b4e6583414fa98194bb6f3c5dbd4bd95be3a..c64413a6740b604282984dea2a8430a6e7478d68 100644 +index 6a7f41755b3b06ccf32802786357ce6f23d64b94..a88aa9e60bba4da37ecc57b850cd970a8d453583 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -581,6 +581,13 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat +@@ -582,6 +582,13 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat Object raw = args.get("meta"); if (raw instanceof ItemMeta) { ((ItemMeta) raw).setVersion(version); |