Interface BlockDataBackend


public interface BlockDataBackend
Represents a data backend for a BlockDataManager
  • Method Details

    • pdc

      static BlockDataBackend pdc(org.bukkit.plugin.Plugin plugin)
      Creates a new BlockDataBackend backed by PersistentDataContainer
      Parameters:
      plugin - The plugin that owns the BlockDataManager
      Returns:
      The BlockDataBackend
    • sqlite

      static BlockDataBackend sqlite(Path path)
      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 chunk
      data - 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

      Saves all data that has been modified with this BlockDataBackend
      Returns:
      A CompletableFuture for the saving task
    • close

      Closes and cleans up any connections if needed
      Returns:
      A CompletableFuture for the closing task
    • loadAll

      Attempts to load all data stored in the backend, not supported by PDC
      Returns:
      A CompletableFuture with all the data
    • attemptMigration

      boolean attemptMigration(BlockDataManager manager)
      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