Package net.citizensnpcs.trait
Class FollowTrait
java.lang.Object
net.citizensnpcs.api.trait.Trait
net.citizensnpcs.trait.FollowTrait
Persists a 
Player to follow while spawned. Optionally allows protecting of the player as well.- 
Field Summary
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidSets theEntityto followdoublebooleanisActive()Returns whether the trait is actively following aEntity.booleanvoidCalled just before the attachedNPCis despawned.voidonSpawn()Called when anNPCis spawned.voidrun()Called every tick if overridden.voidsetFollowingMargin(double margin) voidsetProtect(boolean protect) Sets whether to protect the followed Entity (similar to wolves in Minecraft, attack whoever attacks the entity).
- 
Constructor Details- 
FollowTraitpublic FollowTrait()
 
- 
- 
Method Details- 
followSets theEntityto follow
- 
getFollowing
- 
getFollowingMarginpublic double getFollowingMargin()
- 
isActivepublic boolean isActive()Returns whether the trait is actively following aEntity.
- 
isEnabledpublic boolean isEnabled()
- 
onDespawnpublic void onDespawn()Description copied from class:TraitCalled just before the attachedNPCis despawned.NPC.getEntity()will be non-null.
- 
onSpawnpublic void onSpawn()Description copied from class:TraitCalled when anNPCis spawned.NPC.getEntity()will return null until this is called. This is also called onAttach when the NPC is already spawned.
- 
runpublic void run()Description copied from class:TraitCalled every tick if overridden.
- 
setFollowingMarginpublic void setFollowingMargin(double margin) 
- 
setProtectpublic void setProtect(boolean protect) Sets whether to protect the followed Entity (similar to wolves in Minecraft, attack whoever attacks the entity).
 
-