-
Notifications
You must be signed in to change notification settings - Fork 560
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
Prevent number key usage in GPS-related GUIs #4297
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package me.mrCookieSlime.CSCoreLibPlugin.general.Inventory; | ||
|
||
import org.bukkit.event.inventory.InventoryClickEvent; | ||
|
||
/** | ||
* An old remnant of CS-CoreLib. | ||
* This will be removed once we updated everything. | ||
|
@@ -9,10 +11,18 @@ public class ClickAction { | |
|
||
private boolean right; | ||
private boolean shift; | ||
private boolean numberKey; | ||
|
||
public ClickAction(boolean rightClicked, boolean shiftClicked) { | ||
this.right = rightClicked; | ||
this.shift = shiftClicked; | ||
this.numberKey = false; | ||
} | ||
|
||
public ClickAction(InventoryClickEvent e) { | ||
this.right = e.isRightClick(); | ||
this.shift = e.isShiftClick(); | ||
this.numberKey = e.getClick().name().equals("NUMBER_KEY"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why are you checking the name instead of just the enum itself? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Another way of writing this would be |
||
} | ||
|
||
public boolean isRightClicked() { | ||
|
@@ -22,5 +32,8 @@ public boolean isRightClicked() { | |
public boolean isShiftClicked() { | ||
return shift; | ||
} | ||
|
||
|
||
public boolean isNumberKey() { | ||
return numberKey; | ||
} | ||
} |
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.
I had to lowercase this library or the project wouldn't build, but it's not related to issue #4260