Database Setup
Obfeco stores balances in SQLite (default), MySQL, or YAML files. Pick one with
storage-type in config.yml and restart; /obfeco reload doesn't switch storage.
Currency definitions are always YAML files in currencies/, whatever the storage type. Only
player balances and names go into storage.
SQLite (default)
storage-type: SQLITE
No setup. Data goes into plugins/Obfeco/data.db, opened in WAL mode so leaderboard reads don't
block saves. Right for a single server of any size.
MySQL / MariaDB
For networks that share balances between servers, or if you'd rather keep data on a database host.
Create a database and a user:
sqlCREATE DATABASE obfeco; CREATE USER 'obfeco'@'%' IDENTIFIED BY 'a-strong-password'; GRANT ALL PRIVILEGES ON obfeco.* TO 'obfeco'@'%';Point
config.ymlat it:yamlstorage-type: MYSQL database: host: db.example.com port: 3306 database: obfeco username: obfeco password: a-strong-password pool-size: 10 connection-timeout: 30000 max-lifetime: 1800000Restart. Obfeco creates its tables on first start.
| Key | Default | Description |
|---|---|---|
host |
localhost |
Database host |
port |
3306 |
Database port |
database |
obfeco |
Database name |
username |
obf |
Database user |
password |
test123 |
Database password. Change it. |
pool-size |
10 |
Maximum connections in the pool (at least 2) |
connection-timeout |
30000 |
Milliseconds to wait for a free connection |
max-lifetime |
1800000 |
Milliseconds before a pooled connection is replaced |
The connection uses useSSL=false. The MySQL driver comes from Paper; nothing extra to install.
Tables
| Table | Holds |
|---|---|
obfeco_balances |
One row per player per currency |
obfeco_players |
Last known name per UUID, for leaderboards |
obfeco_meta |
Schema version |
SQLite uses the same three tables inside data.db.
Sharing balances across a network
Point every server at the same database and keep cache.auto-save-on-quit: true. A player's
balances are loaded when they join a server and saved when they leave it, so switching servers
carries them over. Each server keeps the balances of players on it in memory, so don't change an
online player's balance from a different server (for example a console give on the lobby while
they're on survival); run it on the server they're on.
YAML
storage-type: YAML
One file per player at plugins/Obfeco/data/players/<uuid>.yml, holding their name and every
balance. Easy to read and edit by hand. Leaderboards and totals have to read every player file, so
prefer SQLite once you have thousands of players.
Switching storage type
Obfeco doesn't copy balances from one storage type to another. Changing storage-type starts from
an empty store. Move the data yourself before switching, or pick the right storage before players
start earning.