Package redempt.redlib.blockdata.backend
Interface BlockDataBackend
public interface BlockDataBackend
Represents a data backend for a BlockDataManager
- 
Method Summary
Modifier and TypeMethodDescriptionbooleanattemptMigration(BlockDataManager manager) Attempts to migrate SQLite from an older schema used by the previous BlockDataManager libraryclose()Closes and cleans up any connections if neededload(ChunkPosition pos) Loads the String data for a given chunkloadAll()Attempts to load all data stored in the backend, not supported by PDCstatic BlockDataBackendpdc(org.bukkit.plugin.Plugin plugin) Creates a new BlockDataBackend backed by PersistentDataContainerremove(ChunkPosition pos) Removes the data attached to a given chunksave(ChunkPosition pos, String data) Saves String data for a given chunksaveAll()Saves all data that has been modified with this BlockDataBackendstatic BlockDataBackendCreates a new BlockDataBackend backed by SQLite 
- 
Method Details
- 
pdc
Creates a new BlockDataBackend backed by PersistentDataContainer- Parameters:
 plugin- The plugin that owns the BlockDataManager- Returns:
 - The BlockDataBackend
 
 - 
sqlite
Creates a new BlockDataBackend backed by SQLite- Parameters:
 path- The path to the SQLite database- Returns:
 - The BlockDataBackend
 
 - 
load
Loads the String data for a given chunk- Parameters:
 pos- The location of the chunk- Returns:
 - A CompletableFuture with the String data
 
 - 
save
Saves String data for a given chunk- Parameters:
 pos- The location of the chunkdata- The data to save- Returns:
 - A CompletableFuture for the saving task
 
 - 
remove
Removes the data attached to a given chunk- Parameters:
 pos- The location of the chunk- Returns:
 - A CompletableFuture for the removal task
 
 - 
saveAll
CompletableFuture<Void> saveAll()Saves all data that has been modified with this BlockDataBackend- Returns:
 - A CompletableFuture for the saving task
 
 - 
close
CompletableFuture<Void> close()Closes and cleans up any connections if needed- Returns:
 - A CompletableFuture for the closing task
 
 - 
loadAll
CompletableFuture<Map<ChunkPosition,String>> loadAll()Attempts to load all data stored in the backend, not supported by PDC- Returns:
 - A CompletableFuture with all the data
 
 - 
attemptMigration
Attempts to migrate SQLite from an older schema used by the previous BlockDataManager library- Parameters:
 manager- The BlockDataManager- Returns:
 - Whether a migration was performed successfully
 
 
 -