Class Waypoints

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

public class Waypoints extends Trait
  • Constructor Details

    • Waypoints

      public Waypoints()
  • Method Details

    • describeProviders

      public void describeProviders(CommandSender sender)
    • getCurrentProvider

      public WaypointProvider getCurrentProvider()
      Returns the current WaypointProvider. May be null during initialisation.
      Returns:
      The current provider
    • getCurrentProviderName

      public String getCurrentProviderName()
      Returns:
      The current provider name
    • getEditor

      public Editor getEditor(CommandSender player, CommandContext args)
    • 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
    • onAttach

      public void onAttach()
      Description copied from class: Trait
      Called when the trait has been attached to an NPC. Trait.npc will be null until this is called.
      Overrides:
      onAttach in class Trait
    • onSpawn

      public void onSpawn()
      Description copied from class: Trait
      Called when an NPC is spawned. NPC.getEntity() will return null until this is called. This is also called onAttach when the NPC is already spawned.
      Overrides:
      onSpawn in class Trait
    • 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
    • setWaypointProvider

      public boolean setWaypointProvider(String name)
      Sets the current WaypointProvider using the given name.
      Parameters:
      name - The name of the waypoint provider, registered using registerWaypointProvider(Class, String)
      Returns:
      Whether the operation succeeded
    • registerWaypointProvider

      public static void registerWaypointProvider(Class<? extends WaypointProvider> clazz, String name)
      Registers a WaypointProvider, which can be subsequently used by NPCs.
      Parameters:
      clazz - The class of the waypoint provider
      name - The name of the waypoint provider