Package net.citizensnpcs.api.npc
Class MemoryNPCDataStore
java.lang.Object
net.citizensnpcs.api.npc.MemoryNPCDataStore
- All Implemented Interfaces:
NPCDataStore
-
Constructor Summary
Constructors -
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.
-
Constructor Details
-
MemoryNPCDataStore
public MemoryNPCDataStore()
-
-
Method Details
-
clearData
Description copied from interface:NPCDataStoreClears all data about the givenNPCfrom storage. Called when the NPC is removed.- Specified by:
clearDatain interfaceNPCDataStore- Parameters:
npc- The NPC to clear data from
-
clearTraitData
Description copied from interface:NPCDataStoreClears all trait data from all NPCs from the given list of names.- Specified by:
clearTraitDatain interfaceNPCDataStore
-
createUniqueNPCId
- Specified by:
createUniqueNPCIdin interfaceNPCDataStore- Parameters:
registry- The registry for the unique ID.- Returns:
- An ID for a new NPC to identify them uniquely
-
loadInto
Description copied from interface:NPCDataStoreLoads NPCs from disk into the givenNPCRegistry. The registry should be cleared before this is called.- Specified by:
loadIntoin interfaceNPCDataStore- Parameters:
registry- The NPCRegistry to load NPCs into
-
reloadFromSource
public void reloadFromSource()Description copied from interface:NPCDataStoreReloads the data store from source (such as a file on disk).- Specified by:
reloadFromSourcein interfaceNPCDataStore
-
saveToDisk
public void saveToDisk()Description copied from interface:NPCDataStoreNotifies the data store to save all stored data to disk. May be asynchronous.- Specified by:
saveToDiskin interfaceNPCDataStore
-
saveToDiskImmediate
public void saveToDiskImmediate()Description copied from interface:NPCDataStoreNotifies the data store to save all stored data to disk immediately. Must not be asynchronous.- Specified by:
saveToDiskImmediatein interfaceNPCDataStore
-
store
Description copied from interface:NPCDataStoreStores the givenNPCinto memory or to a disk representation.- Specified by:
storein interfaceNPCDataStore- Parameters:
npc- The NPC to store
-
storeAll
Description copied from interface:NPCDataStoreStores allNPCs in the givenNPCRegistryto disk.- Specified by:
storeAllin interfaceNPCDataStore- Parameters:
registry- The registry to store NPCs from
-