/
NPCDataStore.java
57 lines (49 loc) · 1.49 KB
/
NPCDataStore.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package net.citizensnpcs.api.npc;
public interface NPCDataStore {
/**
* Clears all data about the given {@link NPC} from storage. Called when the NPC is removed.
*
* @param npc
* The NPC to clear data from
*/
void clearData(NPC npc);
/**
* @param registry
* The registry for the unique ID.
* @return An ID for a new NPC to identify them uniquely
*/
int createUniqueNPCId(NPCRegistry registry);
/**
* Loads NPCs from disk into the given {@link NPCRegistry}. The registry should be cleared before this is called.
*
* @param registry
* The NPCRegistry to load NPCs into
*/
void loadInto(NPCRegistry registry);
/**
* Reloads the data store from source (such as a file on disk).
*/
void reloadFromSource();
/**
* Notifies the data store to save all stored data to disk. May be asynchronous.
*/
void saveToDisk();
/**
* Notifies the data store to save all stored data to disk <em>immediately</em>. Must not be asynchronous.
*/
void saveToDiskImmediate();
/**
* Stores the given {@link NPC} into memory or to a disk representation.
*
* @param npc
* The NPC to store
*/
void store(NPC npc);
/**
* Stores all {@link NPC}s in the given {@link NPCRegistry} to disk.
*
* @param registry
* The registry to store NPCs from
*/
void storeAll(NPCRegistry registry);
}