java.lang.Object
com.sk89q.worldguard.protection.managers.storage.sql.SQLDriver
All Implemented Interfaces:
RegionDriver

public class SQLDriver extends Object implements RegionDriver
Stores regions using a JDBC connection with support for SQL.

Note, however, that this implementation only supports MySQL.

  • Constructor Details

    • SQLDriver

      public SQLDriver(DataSourceConfig config)
      Create a new instance.
      Parameters:
      config - a configuration
  • Method Details

    • get

      public RegionDatabase get(String name)
      Description copied from interface: RegionDriver
      Get a region database for a world.

      The given name should be a unique name for the world. Due to legacy reasons, there are no stipulations on the case sensitivity of the name. Historically, however, if the driver is a file-based driver, case-sensitivity will vary on whether the underlying filesystem is case-sensitive.

      This method should return quickly.

      Specified by:
      get in interface RegionDriver
      Parameters:
      name - the name of the world, which may be case sensitive
      Returns:
      the world
    • getAll

      public List<RegionDatabase> getAll() throws StorageException
      Description copied from interface: RegionDriver
      Fetch all the region databases that have been stored using this driver. Essentially, return a region database for all worlds that have had regions saved for it in the past.

      As this may require a query to be performed, this method may block for a prolonged period of time.

      Specified by:
      getAll in interface RegionDriver
      Returns:
      a list of databases
      Throws:
      StorageException - thrown if the fetch operation fails
    • getMigrationFolderName

      public String getMigrationFolderName()
      Get the name of the folder in migrations/region containing the migration files.
      Returns:
      the migration folder name