mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-11 10:57:47 +01:00
Don't look at invisible players in LookClose
This commit is contained in:
parent
20306de9a3
commit
8bd543c035
@ -555,7 +555,14 @@ public class EventListen implements Listener {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
ids.remove(i--);
|
||||
try {
|
||||
ids.remove(i--);
|
||||
} catch (IndexOutOfBoundsException ex) {
|
||||
// something caused toRespawn to get modified?
|
||||
Messaging.debug("Some strange chunk loading happened while spawning", npc.getId(),
|
||||
" - check all your NPCs in chunk [" + coord.x + "," + coord.z + "] are spawned");
|
||||
break;
|
||||
}
|
||||
if (Messaging.isDebugging()) {
|
||||
Messaging.debug("Spawned id", npc.getId(), "due to chunk event at [" + coord.x + "," + coord.z + "]");
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import net.citizensnpcs.Settings.Setting;
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
@ -59,6 +60,7 @@ public class LookClose extends Trait implements Toggleable, CommandConfigurable
|
||||
});
|
||||
for (Entity entity : nearby) {
|
||||
if (entity.getType() != EntityType.PLAYER || ((Player) entity).getGameMode() == GameMode.SPECTATOR
|
||||
|| ((Player) entity).hasPotionEffect(PotionEffectType.INVISIBILITY)
|
||||
|| entity.getLocation(CACHE_LOCATION).getWorld() != NPC_LOCATION.getWorld()
|
||||
|| CitizensAPI.getNPCRegistry().getNPC(entity) != null)
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user