From 478654351a0c16d62bb849fb87094dc692e96466 Mon Sep 17 00:00:00 2001 From: Wesley Wolfe Date: Tue, 12 Jun 2012 10:59:29 -0500 Subject: [PATCH] Check world before checking distance. Fixes BUKKIT-1792 --- src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 0ad2920f3e..2c41db32db 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -763,6 +763,9 @@ public class CraftWorld implements World { } public void playEffect(Location location, Effect effect, int data, int radius) { + Validate.notNull(location, "Location cannot be null"); + Validate.notNull(effect, "Effect cannot be null"); + Validate.notNull(location.getWorld(), "World cannot be null"); int packetData = effect.getId(); Packet61WorldEvent packet = new Packet61WorldEvent(packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), data); int distance; @@ -770,6 +773,7 @@ public class CraftWorld implements World { for (Player player : getPlayers()) { if (((CraftPlayer) player).getHandle().netServerHandler == null) continue; + if (!location.getWorld().equals(player.getWorld())) continue; distance = (int) player.getLocation().distanceSquared(location); if (distance <= radius) {