From 5fc153d896653594e215828c3aed4f5acb2e86f0 Mon Sep 17 00:00:00 2001 From: Jordan Date: Sat, 22 Jan 2022 17:25:41 +0100 Subject: [PATCH] fix: PlayerInteractEvent does not necessarily interact with a block (#3463) --- .../plotsquared/bukkit/listener/PlayerEventListener.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java index e88177b80..8628daa02 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java @@ -154,7 +154,6 @@ import org.checkerframework.checker.nullness.qual.NonNull; import java.lang.reflect.Field; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Locale; @@ -1065,9 +1064,13 @@ public class PlayerEventListener extends PlotListener implements Listener { if (area == null) { return; } - PlayerBlockEventType eventType = null; + PlayerBlockEventType eventType; BlockType blocktype1; Block block = event.getClickedBlock(); + if (block == null) { + // We do not care in this case, the player is likely interacting with air ("nothing"). + return; + } Location location = BukkitUtil.adapt(block.getLocation()); Action action = event.getAction(); switch (action) {