Package net.citizensnpcs.npc
Class CitizensTraitFactory
java.lang.Object
net.citizensnpcs.npc.CitizensTraitFactory
- All Implemented Interfaces:
TraitFactory
-
Constructor Summary
Constructors -
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.boolean
isInternalTrait
(Trait trait) Checks whether the given trait is 'internal'.void
registerTrait
(TraitInfo info) Registers a trait using the given information.
-
Constructor Details
-
CitizensTraitFactory
public CitizensTraitFactory()
-
-
Method Details
-
addDefaultTraits
Description copied from interface:TraitFactory
Adds all default traits to a given NPC.- Specified by:
addDefaultTraits
in interfaceTraitFactory
- Parameters:
npc
- The NPC to add default traits to
-
deregisterTrait
Description copied from interface:TraitFactory
Removes a trait. This prevents a trait from being added to an NPC but does not remove existing traits from the NPCs.- Specified by:
deregisterTrait
in interfaceTraitFactory
- Parameters:
info
- The TraitInfo to deregister
-
getRegisteredTraits
Description copied from interface:TraitFactory
Returns all currently registered traits, including internal traits- Specified by:
getRegisteredTraits
in interfaceTraitFactory
- Returns:
-
getTrait
Description copied from interface:TraitFactory
Gets a trait with the given class.- Specified by:
getTrait
in interfaceTraitFactory
- Parameters:
clazz
- Class of the trait- Returns:
- Trait with the given class
-
getTrait
Description copied from interface:TraitFactory
Gets a trait with the given name.- Specified by:
getTrait
in interfaceTraitFactory
- Parameters:
name
- Name of the trait- Returns:
- Trait with the given name
-
getTraitClass
Description copied from interface:TraitFactory
Gets theTrait
class with the given name, or null if not found.- Specified by:
getTraitClass
in interfaceTraitFactory
- Parameters:
name
- The trait name- Returns:
- The trait class
-
getTraitPlot
-
isInternalTrait
Description copied from interface:TraitFactory
Checks whether the given trait is 'internal'. An internal trait is implementation-defined and is default or built-in.- Specified by:
isInternalTrait
in interfaceTraitFactory
- Parameters:
trait
- The trait to check- Returns:
- Whether the trait is an internal trait
-
registerTrait
Description copied from interface:TraitFactory
Registers a trait using the given information.- Specified by:
registerTrait
in interfaceTraitFactory
- Parameters:
info
- Registration information
-