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

Remove guard clause causing unintended side effects in interact blocker #272

Merged
merged 2 commits into from
Oct 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,7 @@ private void handleRightClick(PlayerInteractEvent event)
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;
Expand All @@ -102,7 +97,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