From dffbaf89a383c05ee4e32c8c837dd3b0bf0388c1 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sat, 9 Mar 2019 00:28:21 +0000 Subject: [PATCH] Fix for offhandedness --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java index a259e62b1..dd2878fa6 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java @@ -1741,7 +1741,13 @@ import java.util.regex.Pattern; if (area == null) { return; } - Material type = player.getInventory().getItemInMainHand().getType(); + ItemStack hand = player.getInventory().getItemInMainHand(); + ItemStack offHand = player.getInventory().getItemInOffHand(); + Material type = (hand == null) ? Material.AIR : hand.getType(); + Material offType = (offHand == null) ? Material.AIR : offHand.getType(); + if (type == Material.AIR) { + type = offType; + } if (type.toString().toLowerCase().endsWith("egg")) { Block block = player.getTargetBlockExact(5, FluidCollisionMode.SOURCE_ONLY); if (block != null && block.getType() != Material.AIR) {