SeasonForge logoSeasonForge

Storage

Where SeasonForge keeps player progress, SQLite or MySQL and MariaDB, when it saves, and how claims stay safe.

SeasonForge keeps every player's progress in a database. Out of the box that is a single SQLite file and there is nothing to set up. Use MySQL or MariaDB when several servers share one Battle Pass, or when you want the data in your own database server.

Choosing a database

storage.typeUse it whenSetup
SQLITEOne server. The default.None. The file is plugins/SeasonForge/seasonforge.db.
MYSQLSeveral servers, or your host gives you a MySQL databaseFill in host, port, database, username, password
MARIADBThe same, on a MariaDB serverSame as MySQL
storage:
  type: MYSQL
  host: db.example.net
  port: 3306
  database: seasonforge
  username: seasonforge
  password: "your password"
  use-ssl: false
  table-prefix: "sf_"
  pool-size: 6
  save-interval: 300

The tables are created on the first start. If the database cannot be reached, SeasonForge says so in the console and turns itself off, check the storage section and restart.

What is stored

Everything is kept per player and per season:

WhatNotes
Level, XP and premiumOne row per player per season
Claimed rewardsOne row per player, season, level and track, so a reward can never be claimed twice
Quest progressPer quest, with the reset period it belongs to. NONE quests are kept outside any season.
Shop purchasesPer item, with the limit period it belongs to
Saved reward itemsItems kept for later with rewards.inventory-full: PENDING
Season historyWhich season is running, which ones ended and when, and the last reset times

All tables start with storage.table-prefix (sf_players, sf_claims, sf_quests, sf_purchases, sf_pending_rewards, sf_meta, sf_seasons).

Old seasons are never deleted. They stay in the database under their season id, which is why starting an old season again picks its progress back up. Only /battlepass admin season reset and /battlepass admin reset <player> delete progress, and only for the running season.

When it saves

  • Player data is loaded while the player logs in, before they are in the world, and kept in memory while they play.
  • Changes are saved every storage.save-interval seconds (300 by default), when the player leaves, and when the server stops.
  • Claims, shop purchases, premium changes and completed quests are saved straight away.
  • All database work runs off the main server thread, one statement after another, so a save from leaving always lands before the next load.

Claims and purchases are saved first

A claim is marked first so a second click is ignored, then written to the database, and only then are the rewards given. If the write fails nothing is given, and if the player left first the row is removed so the reward can be claimed later.

A crash or a fast double click can never hand out a reward twice: the claim is in the database before anything is given. Shop purchases work the same way, with the currency refunded if the save fails or the player leaves before it finishes.

Several servers on one database

Point every server at the same MySQL or MariaDB database with the same table-prefix. A player's progress is loaded fresh each time they join a server and saved when they leave, so moving between servers keeps their level, claims and quests.

  • Run the same season folders on every server, with the same season ids.
  • Quest progress made on one server is saved on the interval, on leave and on completion. Leaving one server and joining the next carries it over.

On this page