Package net.citizensnpcs.trait.waypoint
Class Waypoints
java.lang.Object
net.citizensnpcs.api.trait.Trait
net.citizensnpcs.trait.waypoint.Waypoints
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
describeProviders
(CommandSender sender) Returns the currentWaypointProvider
.getEditor
(CommandSender player, CommandContext args) void
Loads a trait.void
onAttach()
Called when the trait has been attached to anNPC
.void
onSpawn()
Called when anNPC
is spawned.static void
registerWaypointProvider
(Class<? extends WaypointProvider> clazz, String name) Registers aWaypointProvider
, which can be subsequently used by NPCs.void
Saves a trait.boolean
setWaypointProvider
(String name) Sets the currentWaypointProvider
using the given name.
-
Constructor Details
-
Waypoints
public Waypoints()
-
-
Method Details
-
describeProviders
-
getCurrentProvider
Returns the currentWaypointProvider
. May be null during initialisation.- Returns:
- The current provider
-
getCurrentProviderName
- Returns:
- The current provider name
-
getEditor
-
load
Description copied from class:Trait
Loads a trait.- Overrides:
load
in classTrait
- 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
-
onSpawn
public void onSpawn()Description copied from class:Trait
Called when anNPC
is spawned.NPC.getEntity()
will return null until this is called. This is also called onAttach when the NPC is already spawned. -
save
Description copied from class:Trait
Saves a trait. -
setWaypointProvider
Sets the currentWaypointProvider
using the given name.- Parameters:
name
- The name of the waypoint provider, registered usingregisterWaypointProvider(Class, String)
- Returns:
- Whether the operation succeeded
-
registerWaypointProvider
Registers aWaypointProvider
, which can be subsequently used by NPCs.- Parameters:
clazz
- The class of the waypoint providername
- The name of the waypoint provider
-