Skip to content

Player Data Storage

Nathan Wolf edited this page Apr 22, 2020 · 2 revisions

By default, Magic will store player data in plugins/Magic/data/players.

Player data contains the classes and spells players have unlocked, SP earned, various stats, stored wands, undo queues (for engineering magic) and a host of other information. It is important to keep these backed up and safe!

Alternate Storage

If you would prefer to store your player data in a database, Magic will easily let you do this!

See the default configs here for examples:

SQLite

player_data_store:
  class: SQLite
  database: players

MySQL

All parameters are optional, though you will hopefully need to at least specify user and password.

player_data_store:
  class: MySQL
  database: magic
  host: localhost
  port: 3306
  user: minecraft
  password: somethingsecure

Postgres

player_data_store:
  class: PostresSQL
  database: magic
  host: localhost
  port: 3306
  user: minecraft
  password: somethingsecure

Migrating Existing Player Data

If you already have player data (this happens as soon as players log in with the plugin installed) and you want to switch data storage, you can do so while easily migrating your data.

It is recommended to turn on a server whitelist during this process, though it may not be necessary.

It is strongly recommended to backup your existing player data before migrating!

In config.yml you would change your existing player_data_store block to migrate_data_store, like this:

migrate_data_store:
  class: Yaml
  folder: data/players

This block has the configuration of where your player data currently resides. The player_data_store block should contain your new player data configuration.

Once this is set up, you should run the /magic migrate command to push the migration process through.

Clone this wiki locally