public class MemoryNPCDataStore extends Object implements NPCDataStore
Constructor and Description |
---|
MemoryNPCDataStore() |
Modifier and Type | Method and Description |
---|---|
void |
clearData(NPC npc)
Clears all data about the given
NPC from storage. |
int |
createUniqueNPCId(NPCRegistry registry) |
void |
loadInto(NPCRegistry registry)
Loads NPCs from disk into the given
NPCRegistry . |
void |
reloadFromSource()
Reloads the data store from source (such as a file on disk).
|
void |
saveToDisk()
Notifies the data store to save all stored data to disk.
|
void |
saveToDiskImmediate()
Notifies the data store to save all stored data to disk immediately.
|
void |
store(NPC npc)
Stores the given
NPC into memory or to a disk representation. |
void |
storeAll(NPCRegistry registry)
Stores all
NPC s in the given NPCRegistry to disk. |
public void clearData(NPC npc)
NPCDataStore
NPC
from storage. Called when the NPC is removed.clearData
in interface NPCDataStore
npc
- The NPC to clear data frompublic int createUniqueNPCId(NPCRegistry registry)
createUniqueNPCId
in interface NPCDataStore
registry
- The registry for the unique ID.public void loadInto(NPCRegistry registry)
NPCDataStore
NPCRegistry
. The registry should be cleared before this is called.loadInto
in interface NPCDataStore
registry
- The NPCRegistry to load NPCs intopublic void saveToDisk()
NPCDataStore
saveToDisk
in interface NPCDataStore
public void saveToDiskImmediate()
NPCDataStore
saveToDiskImmediate
in interface NPCDataStore
public void store(NPC npc)
NPCDataStore
NPC
into memory or to a disk representation.store
in interface NPCDataStore
npc
- The NPC to storepublic void storeAll(NPCRegistry registry)
NPCDataStore
NPC
s in the given NPCRegistry
to disk.storeAll
in interface NPCDataStore
registry
- The registry to store NPCs frompublic void reloadFromSource()
NPCDataStore
reloadFromSource
in interface NPCDataStore
Copyright © 2021. All rights reserved.