Class TraitInfo

java.lang.Object
net.citizensnpcs.api.trait.TraitInfo

public final class TraitInfo extends Object
Builds a trait.
  • Method Details

    • asDefaultTrait

      public TraitInfo asDefaultTrait()
    • checkValid

      public void checkValid()
    • getTraitClass

      public Class<? extends Trait> getTraitClass()
    • getTraitName

      public String getTraitName()
    • isDefaultTrait

      public boolean isDefaultTrait()
    • optInToStats

      public TraitInfo optInToStats()
    • registerListener

      public void registerListener(Plugin plugin)
    • shouldTrackStats

      public boolean shouldTrackStats()
    • tryCreateInstance

      public <T extends Trait> T tryCreateInstance()
    • withName

      public TraitInfo withName(String name)
    • withSupplier

      public TraitInfo withSupplier(Supplier<? extends Trait> supplier)
    • create

      public static TraitInfo create(Class<? extends Trait> trait)
      Constructs a factory with the given trait class. The trait class must have a no-arguments constructor.
      Parameters:
      trait - Class of the trait
      Returns:
      The created TraitInfo
      Throws:
      IllegalArgumentException - If the trait class does not have a no-arguments constructor