Merge pull request #272 from AtlasMediaGroup/fix-interact-blocking

Remove guard clause causing unintended side effects in interact blocker
This commit is contained in:
Paldiu 2022-10-12 11:29:00 -05:00 committed by GitHub
commit a332ecfbea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,12 +71,7 @@ public class InteractBlocker extends FreedomService
final Player player = event.getPlayer(); final Player player = event.getPlayer();
final Block clickedBlock = event.getClickedBlock(); final Block clickedBlock = event.getClickedBlock();
if (clickedBlock == null) if (clickedBlock != null && clickedBlock.getType() == Material.RESPAWN_ANCHOR && !ConfigEntry.ALLOW_RESPAWN_ANCHORS.getBoolean())
{
return;
}
if (clickedBlock.getType() == Material.RESPAWN_ANCHOR && !ConfigEntry.ALLOW_RESPAWN_ANCHORS.getBoolean())
{ {
event.setCancelled(true); event.setCancelled(true);
return; 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); clickedBlock.getWorld().spawnEntity(clickedBlock.getLocation().add(event.getBlockFace().getDirection()).add(0.5, 0.5, 0.5), eggType);
} }