Package net.citizensnpcs.api.npc
Class MemoryNPCDataStore
java.lang.Object
net.citizensnpcs.api.npc.MemoryNPCDataStore
- All Implemented Interfaces:
NPCDataStore
-
Constructor Summary
-
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.
-
Constructor Details
-
MemoryNPCDataStore
public MemoryNPCDataStore()
-
-
Method Details
-
clearData
Description copied from interface:NPCDataStore
Clears all data about the givenNPC
from storage. Called when the NPC is removed.- Specified by:
clearData
in interfaceNPCDataStore
- Parameters:
npc
- The NPC to clear data from
-
createUniqueNPCId
- Specified by:
createUniqueNPCId
in 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:NPCDataStore
Loads NPCs from disk into the givenNPCRegistry
. The registry should be cleared before this is called.- Specified by:
loadInto
in interfaceNPCDataStore
- Parameters:
registry
- The NPCRegistry to load NPCs into
-
reloadFromSource
public void reloadFromSource()Description copied from interface:NPCDataStore
Reloads the data store from source (such as a file on disk).- Specified by:
reloadFromSource
in interfaceNPCDataStore
-
saveToDisk
public void saveToDisk()Description copied from interface:NPCDataStore
Notifies the data store to save all stored data to disk. May be asynchronous.- Specified by:
saveToDisk
in interfaceNPCDataStore
-
saveToDiskImmediate
public void saveToDiskImmediate()Description copied from interface:NPCDataStore
Notifies the data store to save all stored data to disk immediately. Must not be asynchronous.- Specified by:
saveToDiskImmediate
in interfaceNPCDataStore
-
store
Description copied from interface:NPCDataStore
Stores the givenNPC
into memory or to a disk representation.- Specified by:
store
in interfaceNPCDataStore
- Parameters:
npc
- The NPC to store
-
storeAll
Description copied from interface:NPCDataStore
Stores allNPC
s in the givenNPCRegistry
to disk.- Specified by:
storeAll
in interfaceNPCDataStore
- Parameters:
registry
- The registry to store NPCs from
-