Warp Storage - MyWarp/MyWarp GitHub Wiki

Warps are stored in a relational database. MyWarp supports MySQL, MariaDB, H2 and SQLite 3.8.7.2 (or newer). This article explains how to change the database and how to import warps from another database.

Prerequisites

MyWarp uses a normalised database layout to eliminate record duplicates. The table structure is managed automatically by Flyway. When MyWarp is used for the first time, Flyway creates the database schema (if supported) and MyWarp's table structure. Likewise, if an update changes the database layout, these changes will be applied automatically.

Unfortunately, for Flyway to work, no manual changes must be made on MyWarp's table structure. If a shared database management system is used, it is recommended to use a dedicated schema for MyWarp only.

Configuration on Bukkit

Note: Up until 1.11, CraftBukkit and Spigot bundled SQLite 3.7.2. This version did not support transactions and cannot be used. If you are running CraftBukkit or Spigot older than 1.11 and want to use an embedded database, use H2.

The used database can be changed in the configuration file. By default, an H2 database within MyWarp's plugin folder is used.

Configuration Node Effect
storage.url The JDBC connection URL of the database to use (see below).
storage.schema The schema within the database to be used (ignored if the database does not support schemas).
storage.user The database user to be used (ignored if the database does not support authentication).
storage.password The database password to be used (ignored if the database does not support authentication).
storage.properties Additional connection properties passed to the database (see below).

Once all information has been entered, (re)start the server. MyWarp will try to connect with the database using the provided configuration. If the connection fails or MyWarp is unable to correctly initialize its table structure, an error message is displayed and MyWarp will be disabled.

JDBC Connection URLs

The JDBC connection URL connects the Java Virtual Machine to the database. This section gives you an overview of the URLs of all supported databases. Please refer to the official documentation for more information on the required format, additional connection properties etc.:

Database URL Example Notes
MySQL jdbc:mysql://localhost/ Use the storage.schema configuration instead of adding the schema to the URL.
MariaDB jdbc:mariadb://localhost/ Use the storage.schema configuration instead of adding the schema to the URL.
Spigot does not bundle a driver for MariaDB; use the MySQL configuration instead.
SQLite jdbc:sqlite:path/to/file.sqlite SQLite does not support schemas.
H2 jdbc:h2:path/to/file The file extension is added automatically in embedded mode. Use the storage.schema configuration instead of adding the schema to the URL.
If you need to edit the database manually, H2 bundles a fully-featured GUI editor.

storage.properties

In some rare cases, you may want to specify additional properties for the database connection. This can be done via storage.properties. Specify the required option as key-value pairs, i.e.:

storage:
  properties:
    autoReconnect: true
    useSSL: false

Note that these options are passed directly to the database. Thus, available properties depend on the used database management system.

Migrating

If you want to change from one database system and keep existing warps, you have to import them manually. First, configure the new database as described above, then use the following command:

Command Permission Notes
/warp import current <configuration> mywarp.cmd.import For the configuration, see below.

The command will connect to the given database (which should be the old one) and try to import all warps into the current database. Warps that already exist are skipped.

From Versions Before 3.0

To migrate from versions before 3.0 use the command below. Note that there is no way to downgrade to older versions from 3.x.

Command Permission Notes
/warp import legacy [-t:table-to-import] <configuration> mywarp.cmd.import For the configuration, see below.

Note: If you omit -t the import will default to warpTable which was the default table name in MyWarp 2.

This will import all warps into the new database and converting player names to UUIDs. Warps positioned in a world that does not exist on the server are skipped, players without a unique-id are skipped, too. Skips are logged to the server console.

Configuration Format

On Bukkit, use the following format:

jdbc:<engine>://[<username>[:<password>]@]<host>[//<database>]

Note: schema, user and password are only required if the database management system supports them.

For example, to import a H2 database located in MyWarp's plugin folder, use:

jdbc:h2://my_user:my_password@/full/path/to/your/server/plugins/MyWarp/warps//mywarp
⚠️ **GitHub.com Fallback** ⚠️