From 2db2494015176d369dafe9ff971931a3f47bc4c8 Mon Sep 17 00:00:00 2001 From: Shyanne Date: Mon, 17 Jun 2024 18:44:02 -0400 Subject: [PATCH] Fixed null clickedBlock exception (#870) --- .../iridiumskyblock/listeners/PlayerInteractListener.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/iridium/iridiumskyblock/listeners/PlayerInteractListener.java b/src/main/java/com/iridium/iridiumskyblock/listeners/PlayerInteractListener.java index f46679cbd..c72787b0d 100644 --- a/src/main/java/com/iridium/iridiumskyblock/listeners/PlayerInteractListener.java +++ b/src/main/java/com/iridium/iridiumskyblock/listeners/PlayerInteractListener.java @@ -38,6 +38,10 @@ public void onClick(PlayerInteractEvent event) { } } + // If the item in hand is not a bank item, but the player did not click a block, this returns null. + // Normally, this isn't an issue, but we're not ignoring cancelled events to allow crystals to be deposited. + if(event.getClickedBlock() == null) return; + Optional island = IridiumSkyblock.getInstance().getTeamManager().getTeamViaPlayerLocation(player, event.getClickedBlock().getLocation()); if (!island.isPresent()) return; if (!IridiumSkyblock.getInstance().getTeamManager().getTeamPermission(island.get(), user, PermissionType.BLOCK_BREAK)) {