Add in checks for potential NPEs. Fixes BUKKIT-1706 and BUKKIT-1590.
This commit is contained in:
@@ -443,6 +443,8 @@ public class CraftWorld implements World {
|
||||
// Forces the client to update to the new time immediately
|
||||
for (Player p : getPlayers()) {
|
||||
CraftPlayer cp = (CraftPlayer) p;
|
||||
if (cp.getHandle().netServerHandler == null) continue;
|
||||
|
||||
cp.getHandle().netServerHandler.sendPacket(new Packet4UpdateTime(cp.getHandle().getPlayerTime()));
|
||||
}
|
||||
}
|
||||
@@ -767,6 +769,8 @@ public class CraftWorld implements World {
|
||||
radius *= radius;
|
||||
|
||||
for (Player player : getPlayers()) {
|
||||
if (((CraftPlayer) player).getHandle().netServerHandler == null) continue;
|
||||
|
||||
distance = (int) player.getLocation().distanceSquared(location);
|
||||
if (distance <= radius) {
|
||||
((CraftPlayer) player).getHandle().netServerHandler.sendPacket(packet);
|
||||
|
||||
Reference in New Issue
Block a user