Remove guard clause causing unintended side effects

This commit is contained in:
Allink 2022-10-05 08:55:34 +01:00
parent 9f8dafb075
commit 88f53c05b9
No known key found for this signature in database

View File

@ -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);
}