Interface NPCRegistry
- All Known Implementing Classes:
CitizensNPCRegistry
-
Method Summary
Modifier and TypeMethodDescriptioncreateNPC(EntityType type, String name) Creates an despawnedNPC.createNPC(EntityType type, String name, Location loc) Creates an spawnedNPCat the given location.createNPC(EntityType type, UUID uuid, int id, String name) Creates anNPCwith the given id.createNPCUsingItem(EntityType type, String name, ItemStack item) Creates an despawnedNPCusing the given ItemStack to configure it if possible.voidderegister(NPC npc) Deregisters theNPCand removes all data about it from the data store.voidDeregisters allNPCs from this registry.voiddespawnNPCs(DespawnReason reason) Despawn all NPCs within the registry.getById(int id) Gets theNPCwith the given ID if it exists.getByUniqueId(UUID uuid) Gets theNPCwith the given unique ID if it exists.getByUniqueIdGlobal(UUID uuid) Gets theNPCwith the given unique ID if it exists, otherwise null.getName()Gets the name of the registry.booleanvoidSaves the NPCs to the internalNPCDataStoresorted()Returns a sorted view of this registry, sorted by NPC id.Methods inherited from interface Iterable
forEach, iterator, spliterator
-
Method Details
-
createNPC
Creates an despawnedNPC.- Parameters:
type-EntityTypeto assign to the NPCname- Name to give the NPC- Returns:
- Created NPC
-
createNPC
Creates an spawnedNPCat the given location.- Parameters:
type-EntityTypeto assign to the NPCname- Name to give the NPCloc- The location to spawn at- Returns:
- Created NPC
-
createNPC
Creates anNPCwith the given id. WARNING: may overwrite any existing NPC in the registry with the same ID.- Parameters:
type- TheEntityTypeof the NPC.id- The NPC IDname- The NPC name- Returns:
- The created NPC
-
createNPCUsingItem
Creates an despawnedNPCusing the given ItemStack to configure it if possible.- Parameters:
type-EntityTypeto assign to the NPCname- Name to give the NPCitem- ItemStack to configure with- Returns:
- Created NPC
-
deregister
-
deregisterAll
void deregisterAll()Deregisters allNPCs from this registry.deregister(NPC) -
despawnNPCs
Despawn all NPCs within the registry.- Parameters:
reason- The reason to despawn
-
getById
-
getByUniqueId
-
getByUniqueIdGlobal
-
getName
String getName()Gets the name of the registry. Not null. -
getNPC
-
isNPC
-
saveToStore
void saveToStore()Saves the NPCs to the internalNPCDataStore -
sorted
-