-
-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ItemUtils#changeItemMeta, #setItem #7217
base: dev/feature
Are you sure you want to change the base?
ItemUtils#changeItemMeta, #setItem #7217
Conversation
# Conflicts: # src/main/java/ch/njol/skript/bukkitutil/ItemUtils.java
* @param <T> | ||
* @return the updated item | ||
*/ | ||
public static <T extends ItemMeta> T changeItemMeta(@NotNull ItemStack itemStack, @NotNull Consumer<T> metaChanger) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Paper has these editMeta
methods which might be useful call here if available: https://jd.papermc.io/paper/1.21.4/org/bukkit/inventory/ItemStack.html#editMeta(java.util.function.Consumer)
Though, I'm not sure they are doing anything different internally from what is being done here, so it might be worth looking into that first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yep, if it's the same then no need to worry about it.
Description
This PR is to help with shorthand ItemStack changes.
Example: (Before)
(After)
Obviously this will more than likely be
up for debate
but here's hoping.Target Minecraft Versions: any
Requirements: none
Related Issues: none