zRivals Duels logozRivals Duels

Storage

Where zRivals Duels keeps its data, SQLite or MySQL, what is stored, and backups.

Stats, seasons, match history, wagers, snapshots and rewards are kept in a database. SQLite works with no setup at all. MySQL lets several servers share one set of stats, or suits you if you already run a database.

The storage type choice between SQLite in database.db and MySQL with its connection keys, the database tables, and the files kept outside the database.

Settings

storage:
  # Where data is saved: SQLITE (a file in the plugin folder) or MYSQL
  type: SQLITE
  mysql:
    # MySQL server address
    host: localhost
    # MySQL server port
    port: 3306
    # Database name
    database: zrivalsduels
    # MySQL user name
    username: root
    # MySQL password
    password: ""
    # Connect over SSL
    use-ssl: false

The default. Everything is saved in plugins/zRivalsDuels/database.db. Nothing to set up.

Storage settings are read when the server starts. /duel admin reload does not switch databases, restart instead. Switching type does not copy data from one database to the other.

What is stored

All tables start with zrd_.

TableWhat it holds
zrd_playersEach player's name and lifetime stats: wins, losses, draws, total duels, ranked games, best MMR, best rank, best position, season wins and top 3 finishes
zrd_season_statsEach player's MMR, ranked wins, losses and games, best MMR and best rank for each season
zrd_seasonsEvery season's number, name, start, end and whether it is finalised
zrd_season_resultsThe final leaderboard of every finished season
zrd_matchesMatch history: players, hashed IP addresses, mode, kit, arena, winner, how it ended, MMR before and after, wager
zrd_escrowHeld, settled and refunded wager stakes, and whether each payout was delivered
zrd_snapshotsSaved player state during a duel, until they are restored
zrd_reward_grantsEvery reward part, its status, and for real money who marked it paid
zrd_opponent_historyRanked games per player pair, for the same opponent limit
zrd_schemaThe database layout version. Updates bring the tables up to date on start

Every database read and write happens off the main server thread, so a slow database never freezes the server. Online players' stats and the leaderboard are kept in memory for commands, menus and placeholders.

Files outside the database

PathWhat it holds
kits/One file per kit
arenas/One file per arena
data/reward-items.ymlItems saved into reward sets
data/kit-edit/Staff inventories saved by /duel kit load, until /duel kit restore
logs/real-money.logA line for every real money reward granted or marked paid

Backups

  • SQLite: stop the server and copy database.db, or copy it while nobody is in a duel.
  • MySQL: use your usual database backup, for example mysqldump zrivalsduels.
  • Also keep kits/, arenas/ and data/, they are not in the database.

Do not delete zrd_snapshots or zrd_escrow rows by hand. They hold players' real inventories and held wagers until those are given back.

On this page