mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-26 20:55:44 +01:00
Support plugin vanishing in LookClose
This commit is contained in:
parent
afd9cb7ca5
commit
ce9332bc95
@ -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.metadata.MetadataValue;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import net.citizensnpcs.Settings.Setting;
|
||||
@ -63,6 +64,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)
|
||||
|| isPluginVanished((Player) entity)
|
||||
|| entity.getLocation(CACHE_LOCATION).getWorld() != NPC_LOCATION.getWorld()
|
||||
|| CitizensAPI.getNPCRegistry().getNPC(entity) != null)
|
||||
continue;
|
||||
@ -81,6 +83,14 @@ public class LookClose extends Trait implements Toggleable, CommandConfigurable
|
||||
return lookingAt == null;
|
||||
}
|
||||
|
||||
private boolean isPluginVanished(Player player) {
|
||||
for (MetadataValue meta : player.getMetadata("vanished")) {
|
||||
if (meta.asBoolean())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(DataKey key) throws NPCLoadException {
|
||||
range = key.getDouble("range", range);
|
||||
|
Loading…
Reference in New Issue
Block a user