Class CitizensTraitFactory

java.lang.Object
net.citizensnpcs.npc.CitizensTraitFactory
All Implemented Interfaces:
TraitFactory

public class CitizensTraitFactory extends Object implements TraitFactory
  • Constructor Details

    • CitizensTraitFactory

      public CitizensTraitFactory(Citizens plugin)
  • Method Details

    • addDefaultTraits

      public void addDefaultTraits(NPC npc)
      Description copied from interface: TraitFactory
      Adds all default traits to a given NPC.
      Specified by:
      addDefaultTraits in interface TraitFactory
      Parameters:
      npc - The NPC to add default traits to
    • deregisterTrait

      public void deregisterTrait(TraitInfo info)
      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 interface TraitFactory
      Parameters:
      info - The TraitInfo to deregister
    • getRegisteredTraits

      public Collection<TraitInfo> getRegisteredTraits()
      Description copied from interface: TraitFactory
      Returns all currently registered traits, including internal traits
      Specified by:
      getRegisteredTraits in interface TraitFactory
      Returns:
    • getTrait

      public <T extends Trait> T getTrait(Class<T> clazz)
      Description copied from interface: TraitFactory
      Gets a trait with the given class.
      Specified by:
      getTrait in interface TraitFactory
      Parameters:
      clazz - Class of the trait
      Returns:
      Trait with the given class
    • getTrait

      public <T extends Trait> T getTrait(String name)
      Description copied from interface: TraitFactory
      Gets a trait with the given name.
      Specified by:
      getTrait in interface TraitFactory
      Parameters:
      name - Name of the trait
      Returns:
      Trait with the given name
    • getTraitClass

      public Class<? extends Trait> getTraitClass(String name)
      Description copied from interface: TraitFactory
      Gets the Trait class with the given name, or null if not found.
      Specified by:
      getTraitClass in interface TraitFactory
      Parameters:
      name - The trait name
      Returns:
      The trait class
    • registerTrait

      public void registerTrait(TraitInfo info)
      Description copied from interface: TraitFactory
      Registers a trait using the given information.
      Specified by:
      registerTrait in interface TraitFactory
      Parameters:
      info - Registration information
    • trackStats

      public boolean trackStats(Trait trait)