Package net.citizensnpcs.api.trait.trait
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 TypeMethodDescriptionvoid
addChildNPC
(NPC npc) void
Manages NPC hiding using the given permissions groupvoid
addPermission
(String permission) Manages NPC hiding using the given permissionvoid
Manages NPC hiding from the provided UUIDboolean
affectsGroup
(String group) boolean
affectsPlayer
(UUID uuid) void
clear()
Clears all set UUID filters.double
Implementation detail: may change in the future.Implementation detail: may change in the future.Implementation detail: may change in the future.boolean
boolean
boolean
Whether the NPC should be hidden from the given Playervoid
Called just before the attachedNPC
is despawned.boolean
onSeenByPlayer
(Player player) For internal use.void
void
removeGroup
(String group) Unhides the given permissions groupvoid
removePermission
(String permission) Unhides the given permissionvoid
removePlayer
(UUID uuid) Unhides the given Player UUIDvoid
run()
Called every tick if overridden.void
void
setApplyRange
(double range) Sets the range in blocks where the filter applies.void
Implementation detail: may change in the future.void
setPlayerFilter
(Function<Player, Boolean> filter) void
setPlayers
(Set<UUID> players) Implementation detail: may change in the future.
-
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
Manages NPC hiding from the provided UUID- Parameters:
uuid
-
-
affectsGroup
-
affectsPlayer
-
clear
public void clear()Clears all set UUID filters. -
getApplyRange
public double getApplyRange() -
getGroups
Implementation detail: may change in the future. -
getPermissions
Implementation detail: may change in the future. -
getPlayerUUIDs
Implementation detail: may change in the future. -
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:Trait
Called just before the attachedNPC
is despawned.NPC.getEntity()
will be non-null. -
onSeenByPlayer
For internal use. Method signature may be changed at any time. -
recalculate
public void recalculate() -
removeGroup
Unhides the given permissions group -
removePermission
Unhides the given permission -
removePlayer
Unhides the given Player UUID -
run
public void run()Description copied from class:Trait
Called every tick if overridden. -
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
Implementation detail: may change in the future.
-