Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Remove guard clause causing unintended side effects
Browse files Browse the repository at this point in the history
  • Loading branch information
Allink committed Oct 5, 2022
1 parent 9f8dafb commit 91299b1
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,13 @@ private void handleRightClick(PlayerInteractEvent event)
final Player player = event.getPlayer();
final Block clickedBlock = event.getClickedBlock();

if (clickedBlock == null)
if (clickedBlock != null)
{
return;
}

if (clickedBlock.getType() == Material.RESPAWN_ANCHOR && !ConfigEntry.ALLOW_RESPAWN_ANCHORS.getBoolean())
{
event.setCancelled(true);
return;
if (clickedBlock.getType() == Material.RESPAWN_ANCHOR && !ConfigEntry.ALLOW_RESPAWN_ANCHORS.getBoolean())
{
event.setCancelled(true);
return;
}
}

if (Groups.SPAWN_EGGS.contains(event.getMaterial()))
Expand All @@ -102,7 +100,7 @@ private void handleRightClick(PlayerInteractEvent event)
{
//
}
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);
}
Expand Down

0 comments on commit 91299b1

Please sign in to comment.