Package net.citizensnpcs.api.trait
Interface TraitFactory
- All Known Implementing Classes:
CitizensTraitFactory
public interface TraitFactory
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDefaultTraits
(NPC npc) Adds all default traits to a given NPC.void
deregisterTrait
(TraitInfo info) Removes a trait.Returns all currently registered traits, including internal traits<T extends Trait>
TGets a trait with the given class.<T extends Trait>
TGets a trait with the given name.getTraitClass
(String name) Gets theTrait
class with the given name, or null if not found.void
registerTrait
(TraitInfo info) Registers a trait using the given information.
-
Method Details
-
addDefaultTraits
Adds all default traits to a given NPC.- Parameters:
npc
- The NPC to add default traits to
-
deregisterTrait
Removes a trait. This prevents a trait from being added to an NPC but does not remove existing traits from the NPCs.- Parameters:
info
- The TraitInfo to deregister
-
getRegisteredTraits
Collection<TraitInfo> getRegisteredTraits()Returns all currently registered traits, including internal traits- Returns:
-
getTrait
Gets a trait with the given class.- Parameters:
clazz
- Class of the trait- Returns:
- Trait with the given class
-
getTrait
Gets a trait with the given name.- Parameters:
name
- Name of the trait- Returns:
- Trait with the given name
-
getTraitClass
Gets theTrait
class with the given name, or null if not found.- Parameters:
name
- The trait name- Returns:
- The trait class
-
registerTrait
Registers a trait using the given information.- Parameters:
info
- Registration information
-