Storage
How HireHall saves jobs, escrow, claims and stats, and how to use MySQL.
HireHall saves everything in a database: every job, the pay held for active jobs, waiting claims, player stats and ratings. SQLite works with no setup, MySQL is there if you prefer a database server.
SQLite (default)
storage:
type: SQLITE
sqlite-file: data.db
table-prefix: "hirehall_"The data is in plugins/HireHall/data.db. Back it up with the server stopped.
MySQL
storage:
type: MYSQL
table-prefix: "hirehall_"
mysql:
host: localhost
port: 3306
database: hirehall
username: root
password: ""
use-ssl: false
pool-size: 10- Create the database (the tables are created by HireHall).
- Fill in the details and set
type: MYSQL. - Restart the server. Storage changes are not picked up by a reload.
If HireHall cannot connect, it logs the reason and disables itself.
Use one database per server. HireHall keeps active jobs in memory, so two servers pointed at the same tables do not see each other's changes and can overwrite them. Give each server its own table-prefix if they share a MySQL database.
Switching between SQLite and MySQL does not copy any data. Jobs, claims and stats from the old database are not moved over.
Tables
| Table | Holds |
|---|---|
hirehall_jobs | Every job, active and finished, with status, progress, deadline, note, rating, posting mode, unit price and total pay |
hirehall_escrow_money | Money held for an active job |
hirehall_escrow_items | Items held for an active job |
hirehall_claims | Payouts, refunds, deliveries and returned items waiting for their owner |
hirehall_player_stats | Posted, completed and failed counts, and the last known hire limit |
hirehall_player_earnings | Paid out and earned totals per player and currency |
hirehall_ratings | One row per rated job |
hirehall_contributions | Who delivered how much to each community job, and what they earned |
When you update, new tables and columns are added to your existing database by themselves on startup. Nothing needs to be done by hand.
Change table-prefix to keep more than one server's tables in the same database.
How saving works
- Saving happens in the background, never on the main server thread.
- Active jobs are kept in memory and loaded on startup. Until they are loaded, players get a "still loading" message.
- Task progress is saved every few seconds, and at once when a goal is reached.
- Posting, completing, cancelling and paying out are each saved in one go, so a crash cannot leave the pay half moved.
- Items are stored in a format that carries over to newer Minecraft versions. If an item cannot be read (for example after a downgrade), its claim shows Unreadable items instead of losing it.