Fix incorrectly inverted canSee check breaking getNearbyPlayers
This commit is contained in:
parent
4090a625e9
commit
45fff0f420
|
@ -530,8 +530,9 @@ public class NMS {
|
||||||
private static Collection<Player> getNearbyPlayers(Entity from, Location location, double radius) {
|
private static Collection<Player> getNearbyPlayers(Entity from, Location location, double radius) {
|
||||||
List<Player> players = Lists.newArrayList();
|
List<Player> players = Lists.newArrayList();
|
||||||
for (Player player : CitizensAPI.getLocationLookup().getNearbyPlayers(location, radius)) {
|
for (Player player : CitizensAPI.getLocationLookup().getNearbyPlayers(location, radius)) {
|
||||||
if (location.getWorld() != player.getWorld() || from != null && Util.canSee(player, from)
|
if (location.getWorld() != player.getWorld() || location.distance(player.getLocation()) > radius)
|
||||||
|| location.distance(player.getLocation()) > radius)
|
continue;
|
||||||
|
if (from != null && !Util.canSee(player, from))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
players.add(player);
|
players.add(player);
|
||||||
|
|
|
@ -106,9 +106,9 @@ public class Util {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canSee(Player player, Entity from) {
|
public static boolean canSee(Player player, Entity from) {
|
||||||
if (from instanceof Player) {
|
if (from instanceof Player)
|
||||||
return player.canSee((Player) from);
|
return player.canSee((Player) from);
|
||||||
}
|
|
||||||
if (SUPPORTS_ENTITY_CANSEE) {
|
if (SUPPORTS_ENTITY_CANSEE) {
|
||||||
try {
|
try {
|
||||||
return player.canSee(from);
|
return player.canSee(from);
|
||||||
|
|
Loading…
Reference in New Issue