HireHall

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.

Eight cards for the database tables hirehall_jobs, hirehall_claims, hirehall_escrow_money, hirehall_escrow_items, hirehall_player_stats, hirehall_player_earnings and hirehall_ratings with what each holds, plus a card on SQLite or MySQL

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
  1. Create the database (the tables are created by HireHall).
  2. Fill in the details and set type: MYSQL.
  3. 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

TableHolds
hirehall_jobsEvery job, active and finished, with status, progress, deadline, note, rating, posting mode, unit price and total pay
hirehall_escrow_moneyMoney held for an active job
hirehall_escrow_itemsItems held for an active job
hirehall_claimsPayouts, refunds, deliveries and returned items waiting for their owner
hirehall_player_statsPosted, completed and failed counts, and the last known hire limit
hirehall_player_earningsPaid out and earned totals per player and currency
hirehall_ratingsOne row per rated job
hirehall_contributionsWho 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.

On this page