Package net.citizensnpcs.npc
Class CitizensNPCRegistry
java.lang.Object
net.citizensnpcs.npc.CitizensNPCRegistry
- All Implemented Interfaces:
- Iterable<NPC>,- NPCRegistry
- 
Constructor SummaryConstructorsConstructorDescriptionCitizensNPCRegistry(NPCDataStore store) CitizensNPCRegistry(NPCDataStore store, String registryName) 
- 
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.booleaniterator()voidSaves the NPCs to the internalNPCDataStoresorted()Returns a sorted view of this registry, sorted by NPC id.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Constructor Details- 
CitizensNPCRegistry
- 
CitizensNPCRegistry
 
- 
- 
Method Details- 
createNPCDescription copied from interface:NPCRegistryCreates an despawnedNPC.- Specified by:
- createNPCin interface- NPCRegistry
- Parameters:
- type-- EntityTypeto assign to the NPC
- name- Name to give the NPC
- Returns:
- Created NPC
 
- 
createNPCDescription copied from interface:NPCRegistryCreates an spawnedNPCat the given location.- Specified by:
- createNPCin interface- NPCRegistry
- Parameters:
- type-- EntityTypeto assign to the NPC
- name- Name to give the NPC
- loc- The location to spawn at
- Returns:
- Created NPC
 
- 
createNPCDescription copied from interface:NPCRegistryCreates anNPCwith the given id. WARNING: may overwrite any existing NPC in the registry with the same ID.- Specified by:
- createNPCin interface- NPCRegistry
- Parameters:
- type- The- EntityTypeof the NPC.
- id- The NPC ID
- name- The NPC name
- Returns:
- The created NPC
 
- 
createNPCUsingItemDescription copied from interface:NPCRegistryCreates an despawnedNPCusing the given ItemStack to configure it if possible.- Specified by:
- createNPCUsingItemin interface- NPCRegistry
- Parameters:
- type-- EntityTypeto assign to the NPC
- name- Name to give the NPC
- item- ItemStack to configure with
- Returns:
- Created NPC
 
- 
deregisterDescription copied from interface:NPCRegistryDeregisters theNPCand removes all data about it from the data store.- Specified by:
- deregisterin interface- NPCRegistry
- Parameters:
- npc- The NPC to deregister
 
- 
deregisterAllpublic void deregisterAll()Description copied from interface:NPCRegistryDeregisters allNPCs from this registry.NPCRegistry.deregister(NPC)- Specified by:
- deregisterAllin interface- NPCRegistry
 
- 
despawnNPCsDescription copied from interface:NPCRegistryDespawn all NPCs within the registry.- Specified by:
- despawnNPCsin interface- NPCRegistry
- Parameters:
- reason- The reason to despawn
 
- 
getByIdDescription copied from interface:NPCRegistryGets theNPCwith the given ID if it exists.- Specified by:
- getByIdin interface- NPCRegistry
- Parameters:
- id- ID of the NPC
- Returns:
- NPC with the given ID (may or may not be spawned)
 
- 
getByUniqueIdDescription copied from interface:NPCRegistryGets theNPCwith the given unique ID if it exists.- Specified by:
- getByUniqueIdin interface- NPCRegistry
- Parameters:
- uuid- UUID of the NPC
- Returns:
- NPC with the given ID (may or may not be spawned)
 
- 
getByUniqueIdGlobalDescription copied from interface:NPCRegistryGets theNPCwith the given unique ID if it exists, otherwise null.- Specified by:
- getByUniqueIdGlobalin interface- NPCRegistry
- Parameters:
- uuid- ID of the NPC
- Returns:
- NPC with the given UUID
 
- 
getNameDescription copied from interface:NPCRegistryGets the name of the registry. Not null.- Specified by:
- getNamein interface- NPCRegistry
 
- 
getNPCDescription copied from interface:NPCRegistry- Specified by:
- getNPCin interface- NPCRegistry
- Parameters:
- entity- Entity to get the NPC from
- Returns:
- NPC from the given entity or null if not found.
 
- 
isNPCDescription copied from interface:NPCRegistry- Specified by:
- isNPCin interface- NPCRegistry
- Parameters:
- entity- Entity to check
- Returns:
- Whether the given entity is an NPC
 
- 
iterator
- 
saveToStorepublic void saveToStore()Description copied from interface:NPCRegistrySaves the NPCs to the internalNPCDataStore- Specified by:
- saveToStorein interface- NPCRegistry
 
- 
sortedDescription copied from interface:NPCRegistryReturns a sorted view of this registry, sorted by NPC id.- Specified by:
- sortedin interface- NPCRegistry
- Returns:
- A sorted view of the registry
 
 
-