Storage

config.yml > storage.type: SQLITE (single server, default) or MYSQL (MySQL or MariaDB). The driver is provided by Paper.

Server network (MySQL): every server points to the same database (storage.mysql, configurable table prefix). A player finds their discovered cards, counters, holo cards, dust, title, objectives and rewards everywhere; the auction house and leaderboards are shared. Writes are additive (no server overwrites another) and the connection recovers by itself if MySQL restarts.

Items in the inventory stay specific to each server, like any Minecraft item: a card put in your inventory on the lobby does not show up on survival, unless you use an inventory sync plugin. The collection, however, is shared. To move a card from one server to another, use the (shared) auction house. Admin commands on a player connected to another server of the network change the database; that server only sees the change when the player reconnects.

SQLite (plugins/TCG/data.db, driver provided by Paper):

TableContent
tcg_playersuuid, name, last_seen
tcg_cardsplayer_uuid, card_id, amount, first_obtained, last_obtained
tcg_cards (1.1)+ holo_amount, holo_first
tcg_completionsplayer_uuid, group_id, completed_at (collections, milestones nature@25, binder *)
tcg_stats (1.1)player_uuid, stat, value: dust, packs opened, trades...
tcg_players (1.1)+ title
tcg_trades (1.2)trade history: date, players, what each one gave
tcg_market (1.2)auction house listings (serialized item, price, currency, state, deliveries)
tcg_objectives (1.2)objective progress per period (past periods are purged)
tcg_metaschema_version (3 since 1.2)
  • The collection is loaded during pre-login (off the main thread) and then kept in memory while the player is online.
  • Every acquisition is written asynchronously by a dedicated SQLite thread (upsert amount = amount + n, guaranteed order). The main thread never runs a query.
  • On server shutdown, pending writes are completed before closing.
  • A 1.0 or 1.1 database is migrated automatically at startup (tables and columns added, no data modified). Switching from SQLite to MySQL does not copy existing data.
  • StorageProvider is the abstraction: another implementation only has to provide the same operations.