Interface TraitFactory

All Known Implementing Classes:
CitizensTraitFactory

public interface TraitFactory
  • Method Details

    • addDefaultTraits

      void addDefaultTraits(NPC npc)
      Adds all default traits to a given NPC.
      Parameters:
      npc - The NPC to add default traits to
    • deregisterTrait

      void deregisterTrait(TraitInfo info)
      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

      <T extends Trait> T getTrait(Class<T> clazz)
      Gets a trait with the given class.
      Parameters:
      clazz - Class of the trait
      Returns:
      Trait with the given class
    • getTrait

      <T extends Trait> T getTrait(String name)
      Gets a trait with the given name.
      Parameters:
      name - Name of the trait
      Returns:
      Trait with the given name
    • getTraitClass

      Class<? extends Trait> getTraitClass(String name)
      Gets the Trait class with the given name, or null if not found.
      Parameters:
      name - The trait name
      Returns:
      The trait class
    • registerTrait

      void registerTrait(TraitInfo info)
      Registers a trait using the given information.
      Parameters:
      info - Registration information