-
-
Notifications
You must be signed in to change notification settings - Fork 755
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
Fix: disable sign-coloring when edit-sign flag is false #4252
Fix: disable sign-coloring when edit-sign flag is false #4252
Conversation
Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java
Outdated
Show resolved
Hide resolved
…ntListener.java Co-authored-by: powercas_gamer <[email protected]>
Generally a good addition, but maybe this code may utilize ItemTags, kind of like: final org.bukkit.Tag<Material> dyesTag = Bukkit.getTag(org.bukkit.Tag.REGISTRY_ITEMS, NamespacedKey.minecraft("dyes"), Material.class);
if (dyesTag.isTagged(itemStack.getMaterial())) {
// Interact with dye
} I haven't been able to test that, nor do I know or found any information on when the |
I will test it out but we have to keep in mind that not only dyes but also Honeycombs and Glow Ink Sack can be applied on signs. Will they also have the dye tag? |
Yeah, forget what I said. Seems like my online source listed that as a item tag, but scavenging through the paper / minecraft 1.20.2 source does not contain such tag nor is there any other kind of tag to be respected in those Items or general sign manipulation. |
Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java
Outdated
Show resolved
Hide resolved
Is there potentially a better event to use here rather than cancelling the interact? The block changes state so presumably that'll fire an event |
Did some research and asked around on PaperMC discord. It seems that there is no good alternative event to detect players applying dye to signs or waxing them apart from PlayerInteractEvent. Sign coloring was added 1.16 and waxing 1.19. Should that maybe be checked in two separat events for the versions? |
Were any of the items added posted 1.16? If so it will need to done using strings as older servers will not have the Materials and so it will cause issues. No need for separate events though |
Glow Ink Sac was added in 1.17. But if we would cancel PlayerInteractEvent when a player applies honey to a sign in versions below 1.20 it would cancel the Interact even though waxing is not even possible due to the version. Separating events would also allow some fine adjustment: we don't have to cancel interact when a sign is already waxed. |
In that case just have a version check when building the list of items and only add depending of version. No need to do that for "new" items though as it's all strings |
Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java
Outdated
Show resolved
Hide resolved
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.
Looks good, thanks.
Overview
Fixes #4247
Description
#4236 Adds sign coloring to edit-sign flag separately from the use flag. The use flag is typically used to allow interactions with shops etc, but players should not be able to just color every sign if the use flag is needed.