diff options
author | Riley Park <[email protected]> | 2021-05-23 05:05:34 -0700 |
---|---|---|
committer | Riley Park <[email protected]> | 2021-05-23 05:06:39 -0700 |
commit | 4b72327a656354c78be7df85855652d7a57da3f0 (patch) | |
tree | f10622bf68ed450e2c7918bb1ab65e6e5ce888cd | |
parent | 68984b66459f576f0271229bf6a6a674c7e7b9b5 (diff) | |
download | Paper-4b72327a656354c78be7df85855652d7a57da3f0.tar.gz Paper-4b72327a656354c78be7df85855652d7a57da3f0.zip |
ItemStack#editMeta
fixes #5711
-rw-r--r-- | Spigot-API-Patches/0307-ItemStack-editMeta.patch | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Spigot-API-Patches/0307-ItemStack-editMeta.patch b/Spigot-API-Patches/0307-ItemStack-editMeta.patch new file mode 100644 index 0000000000..a205ee2995 --- /dev/null +++ b/Spigot-API-Patches/0307-ItemStack-editMeta.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Riley Park <[email protected]> +Date: Sun, 23 May 2021 05:04:28 -0700 +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 0f8c593ae9bca46081f0b22c2d763a2699175398..08599c42e4f80a7b8306792c5af0c34aa598a7f6 100644 +--- a/src/main/java/org/bukkit/inventory/ItemStack.java ++++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -542,6 +542,21 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor + return result.ensureServerConversions(); // Paper + } + ++ // Paper start ++ /** ++ * Edits the {@link ItemMeta} of this stack. ++ * ++ * @param consumer the meta consumer ++ */ ++ public void editMeta(final @NotNull java.util.function.Consumer<? super ItemMeta> consumer) { ++ final ItemMeta meta = this.getItemMeta(); ++ if (meta != null) { ++ consumer.accept(meta); ++ this.setItemMeta(meta); ++ } ++ } ++ // Paper end ++ + /** + * Get a copy of this ItemStack's {@link ItemMeta}. + * |