Prevent number key usage in GPS-related GUIs#4297
Open
RaphaelFakhri wants to merge 4 commits intoSlimefun:masterfrom
Open
Prevent number key usage in GPS-related GUIs#4297RaphaelFakhri wants to merge 4 commits intoSlimefun:masterfrom
RaphaelFakhri wants to merge 4 commits intoSlimefun:masterfrom
Conversation
1. Added isNumberKey() method to ClickAction class to detect number key usage 2. Modified MenuListener to pass InventoryClickEvent to ClickAction constructor 3. Added special handlers to GPS Control Panel, Waypoint Panel, and GEO Scanner GUIs 4. These changes prevent users from using number keys in GPS GUIs which was causing items to be lost
Contributor
|
Pro Tip!
If your changes do not fall into any of these categories, don't worry. You can just ignore this message in that case! 👀 |
RaphaelFakhri
commented
Mar 5, 2025
Contributor
Slimefun preview buildA Slimefun preview build is available for testing! https://preview-builds.walshy.dev/download/Slimefun/4297/c850d4e6
|
| public ClickAction(InventoryClickEvent e) { | ||
| this.right = e.isRightClick(); | ||
| this.shift = e.isShiftClick(); | ||
| this.numberKey = e.getClick().name().equals("NUMBER_KEY"); |
Contributor
There was a problem hiding this comment.
why are you checking the name instead of just the enum itself?
Author
There was a problem hiding this comment.
- Because comparing an enum to a string always returns false
- Because the bukkit API does not have a native isNumberKey() method, which I would have used
Another way of writing this would be this.numberKey = e.getClick() == ClickType.NUMBER_KEY;, I just thought that a string would be more simple
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Resolves #4260
Proposed changes
Related Issues (if applicable)
Resolves #4260
Checklist
NonnullandNullableannotations to my methods to indicate their behaviour for null values