• 欢迎来到Minecraft插件百科!
  • 对百科编辑一脸懵逼?帮助:快速入门带您快速熟悉百科编辑!
  • 因近日遭受攻击,百科现已限制编辑,有意编辑请加入插件百科企鹅群:223812289

Magic/Player Data Storage

来自Minecraft插件百科
炫宙菌留言 | 贡献2021年6月27日 (日) 15:39的版本 (创建页面,内容为“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,…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转到导航 跳转到搜索

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!

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

Magic can also migrate existing player data from the flatfile format, or from any store type to any other.

See the default configs here for examples.

Using the editor

Use /mconfig editor config player_data_store to edit the player data store configs, and add the following:

SQLite

player_data_store:
  class: SQLite
  database: players

MySQL

MySQL can also be used, this can be useful if you have servers on a Bungee (or other proxy) network and you want their magic data to stay in sync across all servers. Note you will probably also want to set up inventory syncing, which is not something Magic will do for you.

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

player_data_store:
  class: MySQL
  database: magic
  host: yourdatabaseserver
  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 (or the editor) 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 (or it will happen at next boot).

After migration is complete you can remove the migrate_data_store config, using the same editor command as before.