Package net.citizensnpcs.api.npc
Interface NPCDataStore
- All Known Implementing Classes:
MemoryNPCDataStore
,SimpleNPCDataStore
public interface NPCDataStore
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears all data about the givenNPC
from storage.int
createUniqueNPCId
(NPCRegistry registry) void
loadInto
(NPCRegistry registry) Loads NPCs from disk into the givenNPCRegistry
.void
Reloads the data store from source (such as a file on disk).void
Notifies the data store to save all stored data to disk.void
Notifies the data store to save all stored data to disk immediately.void
Stores the givenNPC
into memory or to a disk representation.void
storeAll
(NPCRegistry registry) Stores allNPC
s in the givenNPCRegistry
to disk.
-
Method Details
-
clearData
Clears all data about the givenNPC
from storage. Called when the NPC is removed.- Parameters:
npc
- The NPC to clear data from
-
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 givenNPC
into memory or to a disk representation.- Parameters:
npc
- The NPC to store
-
storeAll
Stores allNPC
s in the givenNPCRegistry
to disk.- Parameters:
registry
- The registry to store NPCs from
-