Fix not being able to place lava near vanished players

This commit is contained in:
destro174 2022-03-05 10:15:58 +01:00
parent 9ecebc929d
commit fe43443cde

View File

@ -877,6 +877,7 @@ class PlayerEventHandler implements Listener
List<Player> players = block.getWorld().getPlayers();
for (Player otherPlayer : players)
{
if (isVanished(otherPlayer)) continue;
Location location = otherPlayer.getLocation();
if (!otherPlayer.equals(player) && otherPlayer.getGameMode() == GameMode.SURVIVAL && player.canSee(otherPlayer) && block.getY() >= location.getBlockY() - 1 && location.distanceSquared(block.getLocation()) < minLavaDistance * minLavaDistance)
{
@ -2010,4 +2011,10 @@ class PlayerEventHandler implements Listener
return result;
}
private boolean isVanished(Player player) {
for (MetadataValue meta : player.getMetadata("vanished")) {
if (meta.asBoolean()) return true;
}
return false;
}
}