diff --git a/src/main/java/me/ryanhamshire/GriefPrevention/BlockEventHandler.java b/src/main/java/me/ryanhamshire/GriefPrevention/BlockEventHandler.java index c326582..4664a55 100644 --- a/src/main/java/me/ryanhamshire/GriefPrevention/BlockEventHandler.java +++ b/src/main/java/me/ryanhamshire/GriefPrevention/BlockEventHandler.java @@ -23,6 +23,7 @@ import java.util.Collection; import java.util.List; import org.bukkit.ChatColor; +import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Tag; @@ -208,8 +209,14 @@ public class BlockEventHandler implements Listener for(int i = 0; i < players.size(); i++) { Player otherPlayer = players.get(i); + + // Ignore players in creative or spectator mode to avoid users from checking if someone is spectating near them + if(otherPlayer.getGameMode() == GameMode.CREATIVE || otherPlayer.getGameMode() == GameMode.SPECTATOR) { + continue; + } + Location location = otherPlayer.getLocation(); - if(!otherPlayer.equals(player) && location.distanceSquared(block.getLocation()) < 9) + if(!otherPlayer.equals(player) && location.distanceSquared(block.getLocation()) < 9 && player.canSee(otherPlayer)) { GriefPrevention.sendMessage(player, TextMode.Err, Messages.PlayerTooCloseForFire2); placeEvent.setCancelled(true); diff --git a/src/main/java/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java b/src/main/java/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java index d10e96e..eea8648 100644 --- a/src/main/java/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java +++ b/src/main/java/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java @@ -1503,7 +1503,7 @@ class PlayerEventHandler implements Listener { Player otherPlayer = players.get(i); Location location = otherPlayer.getLocation(); - if(!otherPlayer.equals(player) && otherPlayer.getGameMode() == GameMode.SURVIVAL && block.getY() >= location.getBlockY() - 1 && location.distanceSquared(block.getLocation()) < minLavaDistance * minLavaDistance) + if(!otherPlayer.equals(player) && otherPlayer.getGameMode() == GameMode.SURVIVAL && player.canSee(otherPlayer) && block.getY() >= location.getBlockY() - 1 && location.distanceSquared(block.getLocation()) < minLavaDistance * minLavaDistance) { instance.sendMessage(player, TextMode.Err, Messages.NoLavaNearOtherPlayer, "another player"); bucketEvent.setCancelled(true);