From 6b90c832820bac1930ee28896559d292cbf8193b Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Thu, 15 Jun 2023 20:27:43 +1000 Subject: [PATCH] SPIGOT-7326: Add ClickType#isMouseClick() By: TheRealRyGuy --- .../java/org/bukkit/event/inventory/ClickType.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/paper-api/src/main/java/org/bukkit/event/inventory/ClickType.java b/paper-api/src/main/java/org/bukkit/event/inventory/ClickType.java index 1b0b47df0c..fa96e8c278 100644 --- a/paper-api/src/main/java/org/bukkit/event/inventory/ClickType.java +++ b/paper-api/src/main/java/org/bukkit/event/inventory/ClickType.java @@ -75,7 +75,17 @@ public enum ClickType { * @return true if this ClickType represents the pressing of a key */ public boolean isKeyboardClick() { - return (this == ClickType.NUMBER_KEY) || (this == ClickType.DROP) || (this == ClickType.CONTROL_DROP); + return (this == ClickType.NUMBER_KEY) || (this == ClickType.DROP) || (this == ClickType.CONTROL_DROP) || (this == ClickType.SWAP_OFFHAND); + } + + /** + * Gets whether this ClickType represents the pressing of a mouse button + * + * @return true if this ClickType represents the pressing of a mouse button + */ + public boolean isMouseClick() { + return (this == ClickType.DOUBLE_CLICK) || (this == ClickType.LEFT) || (this == ClickType.RIGHT) || (this == ClickType.MIDDLE) + || (this == ClickType.WINDOW_BORDER_LEFT) || (this == ClickType.SHIFT_LEFT) || (this == ClickType.SHIFT_RIGHT) || (this == ClickType.WINDOW_BORDER_RIGHT); } /**