diff --git a/patches/api/0308-ItemStack-editMeta.patch b/patches/api/0308-ItemStack-editMeta.patch index 0fd9764156..dcc9218856 100644 --- a/patches/api/0308-ItemStack-editMeta.patch +++ b/patches/api/0308-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 86bd9f14de5c1ff3d797955be1af56e5efcac884..59a026d80b0a0a4890becf98efdbe5325b2c622a 100644 +index 86bd9f14de5c1ff3d797955be1af56e5efcac884..56072cb4d32ca8a09023be08a5a832c2c108379a 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -543,6 +543,31 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor +@@ -543,6 +543,50 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor return result.ensureServerConversions(); // Paper } @@ -27,9 +27,28 @@ index 86bd9f14de5c1ff3d797955be1af56e5efcac884..59a026d80b0a0a4890becf98efdbe532 + * @return {@code true} if the edit was successful, {@code false} otherwise + */ + public boolean editMeta(final @NotNull java.util.function.Consumer super ItemMeta> consumer) { -+ final ItemMeta meta = this.getItemMeta(); -+ if (meta != null) { -+ consumer.accept(meta); ++ return editMeta(ItemMeta.class, consumer); ++ } ++ ++ /** ++ * Edits the {@link ItemMeta} of this stack if the meta is of the specified type. ++ *
++ * The {@link java.util.function.Consumer} must only interact ++ * with this stack's {@link ItemMeta} through the provided {@link ItemMeta} instance. ++ * Calling this method or any other meta-related method of the {@link ItemStack} class ++ * (such as {@link #getItemMeta()}, {@link #addItemFlags(ItemFlag...)}, {@link #lore()}, etc.) ++ * from inside the consumer is disallowed and will produce undefined results or exceptions. ++ *
++ * ++ * @param metaClass the type of meta to edit ++ * @param consumer the meta consumer ++ * @param