Class Spawned

java.lang.Object
net.citizensnpcs.api.trait.Trait
net.citizensnpcs.api.trait.trait.Spawned
All Implemented Interfaces:
Runnable, Listener

public class Spawned extends Trait
Represents the spawn state of an NPC. This only determines whether an NPC should spawn onEnable. For checking if an NPC's entity is spawned, use NPC.isSpawned().
  • Constructor Details

    • Spawned

      public Spawned()
  • Method Details

    • load

      public void load(DataKey key) throws NPCLoadException
      Description copied from class: Trait
      Loads a trait.
      Overrides:
      load in class Trait
      Parameters:
      key - DataKey to load from
      Throws:
      NPCLoadException - Thrown if this trait failed to load properly
    • save

      public void save(DataKey key)
      Description copied from class: Trait
      Saves a trait.
      Overrides:
      save in class Trait
      Parameters:
      key - DataKey to save to
    • setSpawned

      public void setSpawned(boolean shouldSpawn)
      Sets whether an NPC should spawn during server starts or reloads.
      Parameters:
      shouldSpawn - Whether an NPC should spawn
    • shouldSpawn

      public boolean shouldSpawn()
      Gets whether an NPC should spawn during server starts or reloads.
      Returns:
      Whether an NPC should spawn
    • toString

      public String toString()
      Overrides:
      toString in class Object