Interface NPCDataStore

All Known Implementing Classes:
MemoryNPCDataStore, SimpleNPCDataStore

public interface NPCDataStore
  • Method Details

    • clearData

      void clearData(NPC npc)
      Clears all data about the given NPC from storage. Called when the NPC is removed.
      Parameters:
      npc - The NPC to clear data from
    • createUniqueNPCId

      int createUniqueNPCId(NPCRegistry registry)
      Parameters:
      registry - The registry for the unique ID.
      Returns:
      An ID for a new NPC to identify them uniquely
    • loadInto

      void loadInto(NPCRegistry registry)
      Loads NPCs from disk into the given NPCRegistry. The registry should be cleared before this is called.
      Parameters:
      registry - The NPCRegistry to load NPCs into
    • 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

      void store(NPC npc)
      Stores the given NPC into memory or to a disk representation.
      Parameters:
      npc - The NPC to store
    • storeAll

      void storeAll(NPCRegistry registry)
      Stores all NPCs in the given NPCRegistry to disk.
      Parameters:
      registry - The registry to store NPCs from
    • reloadFromSource

      void reloadFromSource()
      Reloads the data store from source (such as a file on disk).