Storage & importing
Choosing a database
| Type | Use it for |
|---|---|
sqlite (default) | One server. A single file, homes.db, nothing to set up. |
mysql / mariadb | A network, or if you'd just rather have your data in MySQL. |
mongodb | A network that already runs MongoDB. The driver (about 2.4 MB) is downloaded into plugins/BerryHomes/libs/ on the first start and checked against its known hash. |
storage:
type: mongodb
table-prefix: bh_
mongodb:
uri: mongodb://user:pass@10.0.0.5:27017
database: berryhomes
Tables (or collections) are created on first start. table-prefix lets several servers or plugins share a database without clashing.
The server never waits for the database: homes load while a player logs in, and saves are batched and written in the background.
If the database goes down, the server carries on. Players keep using their homes from memory, and with SQLite or MySQL/MariaDB their changes wait and are saved once the database is back, with a warning in the console meanwhile. With MongoDB, a change that can't be saved tells the player and logs the error.
Switching databases
/ahome migrate <sqlite|mysql|mongodb> copies every home from the current storage to another one, using the settings for that type in config.yml. Homes already in the target are kept. Then change storage.type and restart.
- Fill in the
mysql:(ormongodb:) section, leavingtypeas it is. - Run
/ahome migrate mysqland wait for "done". - Set
type: mysqland restart.
Importing from other plugins
| Plugin | Command | What's read |
|---|---|---|
| EssentialsX | /ahome convertall or /ahome import essentials | plugins/Essentials/userdata/*.yml |
| HuskHomes | /ahome import huskhomes | HuskHomes' SQLite database |
| ModernHome | /ahome import modernhome | Its SQLite file or MySQL database (whatever its database.yml says) |
Add dryrun to see what would happen without saving anything:
/ahome import essentials dryrun
Imports run in the background and report progress. Homes a player already has (same name) are skipped, so running one twice is safe. Names that break the name rules (a space, too long) are fixed, and the report says how many were. Homes in worlds that don't exist any more are still imported.
HuskHomes homes are imported as homes on this server (server-name).
ModernHome homes keep their numbers. Unnamed ones get your slot-name (home1, home2...), and renamed ones keep their colours as a fancy name. On a network, each home keeps the server it was set on. ModernHome saves whole-block positions, so players land in the middle of the block. If it runs on MongoDB, switch it to SQLite or MySQL with its own /ahome migrate first.
If a player already has homes in BerryHomes, imported homes keep their number when it's free and take the next free number when it isn't, so nobody ends up with two homes on the same number.