editMeta: tighten contract via docs (#5714)

This commit is contained in:
Gergely Sarkozi 2021-05-30 13:45:46 +02:00
parent 51b2370434
commit 027b85caf3

View file

@ -15,6 +15,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ /**
+ * Edits the {@link ItemMeta} of this stack.
+ * <p>
+ * 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.
+ * </p>
+ *
+ * @param consumer the meta consumer
+ * @return {@code true} if the edit was successful, {@code false} otherwise