Package net.citizensnpcs.api.npc
Interface NPCRegistry
- All Known Implementing Classes:
- CitizensNPCRegistry
Controls the registration and lookup of a set of 
NPCs.- 
Method SummaryModifier 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 java.lang.IterableforEach, iterator, spliterator
- 
Method Details- 
createNPCCreates an despawnedNPC.- Parameters:
- type-- EntityTypeto assign to the NPC
- name- Name to give the NPC
- Returns:
- Created NPC
 
- 
createNPCCreates an spawnedNPCat the given location.- Parameters:
- type-- EntityTypeto assign to the NPC
- name- Name to give the NPC
- loc- The location to spawn at
- Returns:
- Created NPC
 
- 
createNPCCreates anNPCwith the given id. WARNING: may overwrite any existing NPC in the registry with the same ID.- Parameters:
- type- The- EntityTypeof the NPC.
- id- The NPC ID
- name- The NPC name
- Returns:
- The created NPC
 
- 
createNPCUsingItemCreates an despawnedNPCusing the given ItemStack to configure it if possible.- Parameters:
- type-- EntityTypeto assign to the NPC
- name- Name to give the NPC
- item- ItemStack to configure with
- Returns:
- Created NPC
 
- 
deregisterDeregisters theNPCand removes all data about it from the data store.- Parameters:
- npc- The NPC to deregister
 
- 
deregisterAllvoid deregisterAll()Deregisters allNPCs from this registry.deregister(NPC)
- 
despawnNPCsDespawn all NPCs within the registry.- Parameters:
- reason- The reason to despawn
 
- 
getByIdGets theNPCwith the given ID if it exists.- Parameters:
- id- ID of the NPC
- Returns:
- NPC with the given ID (may or may not be spawned)
 
- 
getByUniqueIdGets theNPCwith the given unique ID if it exists.- Parameters:
- uuid- UUID of the NPC
- Returns:
- NPC with the given ID (may or may not be spawned)
 
- 
getByUniqueIdGlobalGets theNPCwith the given unique ID if it exists, otherwise null.- Parameters:
- uuid- ID of the NPC
- Returns:
- NPC with the given UUID
 
- 
getNameString getName()Gets the name of the registry. Not null.
- 
getNPC- Parameters:
- entity- Entity to get the NPC from
- Returns:
- NPC from the given entity or null if not found.
 
- 
isNPC- Parameters:
- entity- Entity to check
- Returns:
- Whether the given entity is an NPC
 
- 
saveToStorevoid saveToStore()Saves the NPCs to the internalNPCDataStore
- 
sortedReturns a sorted view of this registry, sorted by NPC id.- Returns:
- A sorted view of the registry
 
 
-