mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Change return type of ItemStack#editMeta to allow checking for successful vs non-successful edits
This commit is contained in:
parent
455960096d
commit
0edaf770ea
1 changed files with 4 additions and 1 deletions
|
@ -17,13 +17,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ * Edits the {@link ItemMeta} of this stack.
|
||||
+ *
|
||||
+ * @param consumer the meta consumer
|
||||
+ * @return {@code true} if the edit was successful, {@code false} otherwise
|
||||
+ */
|
||||
+ public void editMeta(final @NotNull java.util.function.Consumer<? super ItemMeta> consumer) {
|
||||
+ public boolean editMeta(final @NotNull java.util.function.Consumer<? super ItemMeta> consumer) {
|
||||
+ final ItemMeta meta = this.getItemMeta();
|
||||
+ if (meta != null) {
|
||||
+ consumer.accept(meta);
|
||||
+ this.setItemMeta(meta);
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
|
|
Loading…
Reference in a new issue