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