Fix incorrectly inverted canSee check breaking getNearbyPlayers

This commit is contained in:
fullwall 2024-03-23 20:47:11 +08:00
parent 4090a625e9
commit 45fff0f420
2 changed files with 5 additions and 4 deletions

View File

@ -530,8 +530,9 @@ public class NMS {
private static Collection<Player> getNearbyPlayers(Entity from, Location location, double radius) {
List<Player> players = Lists.newArrayList();
for (Player player : CitizensAPI.getLocationLookup().getNearbyPlayers(location, radius)) {
if (location.getWorld() != player.getWorld() || from != null && Util.canSee(player, from)
|| location.distance(player.getLocation()) > radius)
if (location.getWorld() != player.getWorld() || location.distance(player.getLocation()) > radius)
continue;
if (from != null && !Util.canSee(player, from))
continue;
players.add(player);

View File

@ -106,9 +106,9 @@ public class Util {
}
public static boolean canSee(Player player, Entity from) {
if (from instanceof Player) {
if (from instanceof Player)
return player.canSee((Player) from);
}
if (SUPPORTS_ENTITY_CANSEE) {
try {
return player.canSee(from);