Package net.citizensnpcs.api.npc
Interface NPCDataStore
- All Known Implementing Classes:
 MemoryNPCDataStore,SimpleNPCDataStore
public interface NPCDataStore
- 
Method Summary
Modifier and TypeMethodDescriptionvoidClears all data about the givenNPCfrom storage.voidclearTraitData(Iterable<String> traitNames) Clears all trait data from all NPCs from the given list of names.intcreateUniqueNPCId(NPCRegistry registry) voidloadInto(NPCRegistry registry) Loads NPCs from disk into the givenNPCRegistry.voidReloads the data store from source (such as a file on disk).voidNotifies the data store to save all stored data to disk.voidNotifies the data store to save all stored data to disk immediately.voidStores the givenNPCinto memory or to a disk representation.voidstoreAll(NPCRegistry registry) Stores allNPCs in the givenNPCRegistryto disk. 
- 
Method Details
- 
clearData
Clears all data about the givenNPCfrom storage. Called when the NPC is removed.- Parameters:
 npc- The NPC to clear data from
 - 
clearTraitData
Clears all trait data from all NPCs from the given list of names. - 
createUniqueNPCId
- Parameters:
 registry- The registry for the unique ID.- Returns:
 - An ID for a new NPC to identify them uniquely
 
 - 
loadInto
Loads NPCs from disk into the givenNPCRegistry. The registry should be cleared before this is called.- Parameters:
 registry- The NPCRegistry to load NPCs into
 - 
reloadFromSource
void reloadFromSource()Reloads the data store from source (such as a file on disk). - 
saveToDisk
void saveToDisk()Notifies the data store to save all stored data to disk. May be asynchronous. - 
saveToDiskImmediate
void saveToDiskImmediate()Notifies the data store to save all stored data to disk immediately. Must not be asynchronous. - 
store
Stores the givenNPCinto memory or to a disk representation.- Parameters:
 npc- The NPC to store
 - 
storeAll
Stores allNPCs in the givenNPCRegistryto disk.- Parameters:
 registry- The registry to store NPCs from
 
 -