From 88f53c05b9f1c156cf292b9da66a3db2b4f533a2 Mon Sep 17 00:00:00 2001 From: Allink Date: Wed, 5 Oct 2022 08:55:34 +0100 Subject: [PATCH] Remove guard clause causing unintended side effects --- .../totalfreedommod/blocking/InteractBlocker.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java index f9aa91fe..6a70f7d4 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java @@ -71,12 +71,7 @@ public class InteractBlocker extends FreedomService final Player player = event.getPlayer(); final Block clickedBlock = event.getClickedBlock(); - if (clickedBlock == null) - { - return; - } - - if (clickedBlock.getType() == Material.RESPAWN_ANCHOR && !ConfigEntry.ALLOW_RESPAWN_ANCHORS.getBoolean()) + if (clickedBlock != null && clickedBlock.getType() == Material.RESPAWN_ANCHOR && !ConfigEntry.ALLOW_RESPAWN_ANCHORS.getBoolean()) { event.setCancelled(true); return; @@ -102,7 +97,7 @@ public class InteractBlocker extends FreedomService { // } - if (eggType != null) + if (eggType != null && clickedBlock != null) { clickedBlock.getWorld().spawnEntity(clickedBlock.getLocation().add(event.getBlockFace().getDirection()).add(0.5, 0.5, 0.5), eggType); }