Class PlayerFilter
java.lang.Object
net.citizensnpcs.api.trait.Trait
net.citizensnpcs.api.trait.trait.PlayerFilter
-
Nested Class Summary
Nested Classes -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionPlayerFilter(BiConsumer<Player, Entity> hideFunction, BiConsumer<Player, Entity> viewFunction) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChildNPC(NPC npc) voidManages NPC hiding using the given permissions groupvoidaddPermission(String permission) Manages NPC hiding using the given permissionvoidManages NPC hiding from the provided UUIDbooleanaffectsGroup(String group) booleanaffectsPlayer(UUID uuid) voidclear()Clears all set UUID filters.doubleImplementation detail: may change in the future.Implementation detail: may change in the future.Implementation detail: may change in the future.booleanbooleanbooleanWhether the NPC should be hidden from the given PlayervoidCalled just before the attachedNPCis despawned.booleanonSeenByPlayer(Player player) For internal use.voidvoidremoveGroup(String group) Unhides the given permissions groupvoidremovePermission(String permission) Unhides the given permissionvoidremovePlayer(UUID uuid) Unhides the given Player UUIDvoidrun()Called every tick if overridden.voidvoidsetApplyRange(double range) Sets the range in blocks where the filter applies.voidImplementation detail: may change in the future.voidsetPlayerFilter(Function<Player, Boolean> filter) voidsetPlayers(Set<UUID> players) Implementation detail: may change in the future.Methods inherited from class Trait
getName, getNPC, getTraitId, isRunImplemented, linkToNPC, load, onAttach, onCopy, onDespawn, onPreSpawn, onRemove, onRemove, onSpawn, save
-
Constructor Details
-
PlayerFilter
public PlayerFilter() -
PlayerFilter
-
-
Method Details
-
addChildNPC
-
addGroup
Manages NPC hiding using the given permissions group -
addPermission
Manages NPC hiding using the given permission -
addPlayer
-
affectsGroup
-
affectsPlayer
-
clear
public void clear()Clears all set UUID filters. -
getApplyRange
public double getApplyRange() -
getGroups
-
getPermissions
-
getPlayerUUIDs
-
isAllowlist
public boolean isAllowlist() -
isDenylist
public boolean isDenylist() -
isHidden
Whether the NPC should be hidden from the given Player -
onDespawn
public void onDespawn()Description copied from class:TraitCalled just before the attachedNPCis despawned.NPC.getEntity()will be non-null. -
onSeenByPlayer
For internal use. Method signature may be changed at any time. -
recalculate
-
removeGroup
Unhides the given permissions group -
removePermission
Unhides the given permission -
removePlayer
Unhides the given Player UUID -
run
-
setAllowlist
public void setAllowlist() -
setApplyRange
public void setApplyRange(double range) Sets the range in blocks where the filter applies. For example, if the range is 25 blocks and the Player is more than 25 blocks away, the filter is ignored and the Player will not be hidden.- Parameters:
range- The new range
-
setDenylist
public void setDenylist()Implementation detail: may change in the future. -
setPlayerFilter
-
setPlayers
-