Storage
What gets stored, where it goes, and how to move from SQLite to MySQL.
WandWorks stores two things per player: their running totals, and the last bag choice they made. Wand uses are not in here, those live on the item.
Choosing a backend
The default, and there is nothing to set up.
storage:
type: sqlite
save-interval: 60A data.db file appears in plugins/WandWorks/ on first start. Back it up with the rest of the folder.
Storage settings are read once at startup. Changing type or any MySQL detail needs a full restart, not /wandworks reload.
The tables
Both are created on first start if they are not already there.
| Column | Holds |
|---|---|
uuid | The player, primary key |
money_earned | Total paid out by sell wands |
items_sold | Total items sold |
blocks_placed | Total blocks placed by builder wands |
money_spent | Total charged by shop mode builder wands |
| Column | Holds |
|---|---|
uuid | The player, primary key |
bag_default | The last bag choice they made |
A player who has never touched the bag toggle has no row here at all. That is what lets a fresh wand fall back to bag-default in wands.yml rather than always starting off. See Bag mode.
When writes happen
Nothing touches the database on the main thread while the server is running.
At join
The player's row is read on a background thread. Until it lands they count as a blank record, so nothing blocks and nothing is lost.
On a timer
Every save-interval seconds, every record that has changed is written in one batch. Records that have not changed are skipped.
At quit
The player's record is written and dropped from memory.
At shutdown
One final flush, on the main thread, which is the one place a blocking write is the right thing to do.
save-interval is in seconds and anything under 5 is raised to 5. The shipped 60 is fine for almost every server. Lower it if you restart often and mind losing the last minute of totals.
Moving from SQLite to MySQL
There is no built in converter. The tables are two flat lists keyed on UUID, so any tool that reads SQLite and writes MySQL will do it.
Stop the server
The final flush on shutdown has to land before you copy anything.
Copy both tables
wandworks_stats and wandworks_settings, out of data.db and into your MySQL database.
Point the config at MySQL
Set storage.type: mysql and fill in the connection details.
Start and check
Play, then check a row updated. Keep data.db until you are sure.
When storage cannot start
If the database will not open, WandWorks logs the reason and carries on with stats switched off:
[WandWorks] Storage could not start, stats will not be saved.Wands keep working. Totals are not recorded, and the bag choice is remembered only for that session. Fix the connection details and restart.