Tweaked lava buckets near players rule.

Ignoring non-survival players because they can't be injured, and leaving
the nearby player's name out to avoid outing any invisible players.
This commit is contained in:
ryanhamshire 2015-01-07 15:14:30 -08:00
parent 6568e41b60
commit c5fab8dcd9

View File

@ -31,6 +31,7 @@ import java.util.regex.Pattern;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
@ -1175,9 +1176,9 @@ class PlayerEventHandler implements Listener
{ {
Player otherPlayer = players.get(i); Player otherPlayer = players.get(i);
Location location = otherPlayer.getLocation(); Location location = otherPlayer.getLocation();
if(!otherPlayer.equals(player) && block.getY() >= location.getBlockY() - 1 && location.distanceSquared(block.getLocation()) < minLavaDistance * minLavaDistance) if(!otherPlayer.equals(player) && otherPlayer.getGameMode() == GameMode.SURVIVAL && block.getY() >= location.getBlockY() - 1 && location.distanceSquared(block.getLocation()) < minLavaDistance * minLavaDistance)
{ {
GriefPrevention.sendMessage(player, TextMode.Err, Messages.NoLavaNearOtherPlayer, otherPlayer.getName()); GriefPrevention.sendMessage(player, TextMode.Err, Messages.NoLavaNearOtherPlayer, "another player");
bucketEvent.setCancelled(true); bucketEvent.setCancelled(true);
return; return;
} }