From ec4a7e5d87e8ab5906f742d7de1b2adedf0887f3 Mon Sep 17 00:00:00 2001 From: Madeline Miller Date: Sun, 29 Aug 2021 17:00:56 +1000 Subject: [PATCH] Add helpers for left/right click to Action --- .../java/org/bukkit/event/block/Action.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/paper-api/src/main/java/org/bukkit/event/block/Action.java b/paper-api/src/main/java/org/bukkit/event/block/Action.java index 25d26e3fe7..f0b672bbfc 100644 --- a/paper-api/src/main/java/org/bukkit/event/block/Action.java +++ b/paper-api/src/main/java/org/bukkit/event/block/Action.java @@ -29,5 +29,25 @@ public enum Action { *
  • Triggering tripwire * */ - PHYSICAL, + // Paper start + PHYSICAL; + + /** + * Gets whether this action is a result of a left click. + * + * @return Whether it's a left click + */ + public boolean isLeftClick() { + return this == LEFT_CLICK_AIR || this == LEFT_CLICK_BLOCK; + } + + /** + * Gets whether this action is a result of a right click. + * + * @return Whether it's a right click + */ + public boolean isRightClick() { + return this == RIGHT_CLICK_AIR || this == RIGHT_CLICK_BLOCK; + } + // Paper end }