mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-09-24 21:32:52 +02: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;
|
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()) {
|
if (Messaging.isDebugging()) {
|
||||||
Messaging.debug("Spawned id", npc.getId(), "due to chunk event at [" + coord.x + "," + coord.z + "]");
|
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.EntityType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
import net.citizensnpcs.Settings.Setting;
|
import net.citizensnpcs.Settings.Setting;
|
||||||
import net.citizensnpcs.api.CitizensAPI;
|
import net.citizensnpcs.api.CitizensAPI;
|
||||||
@ -59,6 +60,7 @@ public class LookClose extends Trait implements Toggleable, CommandConfigurable
|
|||||||
});
|
});
|
||||||
for (Entity entity : nearby) {
|
for (Entity entity : nearby) {
|
||||||
if (entity.getType() != EntityType.PLAYER || ((Player) entity).getGameMode() == GameMode.SPECTATOR
|
if (entity.getType() != EntityType.PLAYER || ((Player) entity).getGameMode() == GameMode.SPECTATOR
|
||||||
|
|| ((Player) entity).hasPotionEffect(PotionEffectType.INVISIBILITY)
|
||||||
|| entity.getLocation(CACHE_LOCATION).getWorld() != NPC_LOCATION.getWorld()
|
|| entity.getLocation(CACHE_LOCATION).getWorld() != NPC_LOCATION.getWorld()
|
||||||
|| CitizensAPI.getNPCRegistry().getNPC(entity) != null)
|
|| CitizensAPI.getNPCRegistry().getNPC(entity) != null)
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user