mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 18:27:41 +01:00
Check world before checking distance. Fixes BUKKIT-1792
By: Wesley Wolfe <weswolf@aol.com>
This commit is contained in:
parent
aae6c59efb
commit
add9437bd5
@ -763,6 +763,9 @@ public class CraftWorld implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void playEffect(Location location, Effect effect, int data, int radius) {
|
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();
|
int packetData = effect.getId();
|
||||||
Packet61WorldEvent packet = new Packet61WorldEvent(packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), data);
|
Packet61WorldEvent packet = new Packet61WorldEvent(packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), data);
|
||||||
int distance;
|
int distance;
|
||||||
@ -770,6 +773,7 @@ public class CraftWorld implements World {
|
|||||||
|
|
||||||
for (Player player : getPlayers()) {
|
for (Player player : getPlayers()) {
|
||||||
if (((CraftPlayer) player).getHandle().netServerHandler == null) continue;
|
if (((CraftPlayer) player).getHandle().netServerHandler == null) continue;
|
||||||
|
if (!location.getWorld().equals(player.getWorld())) continue;
|
||||||
|
|
||||||
distance = (int) player.getLocation().distanceSquared(location);
|
distance = (int) player.getLocation().distanceSquared(location);
|
||||||
if (distance <= radius) {
|
if (distance <= radius) {
|
||||||
|
Loading…
Reference in New Issue
Block a user