Skip to content

Storage

joogiebear edited this page Jul 15, 2026 · 2 revisions

Storage

Backends

EconGuard keeps the unified ledger and the flag list via HikariCP, on either SQLite (default, single server) or MySQL (a shared audit DB across a network — the recommended setup so every server reports into one ledger). Pick one in the storage: section of config.yml:

storage:
  type: SQLITE            # or MYSQL
  sqlite-file: econguard.db
  mysql:
    host: localhost
    port: 3306
    database: econguard
    username: root
    password: ""
    properties: "useSSL=false"
    pool-size: 10

The JDBC driver and HikariCP are downloaded at runtime by Paper's library loader — nothing is bundled into the jar. Changing type needs a full restart. Either way there are two logical tables: the money ledger (every reported MoneyEvent) and the flags list.

SQLite (default)

An econguard.db file in plugins/EconGuard/. You may also see econguard.db-wal and econguard.db-shm alongside it — SQLite's write-ahead log and shared-memory files. They're normal; don't delete them while the server is running.

MySQL (networks)

Create the database once (CREATE DATABASE econguard;) and grant your user access; EconGuard creates its tables on first connect. A shared MySQL ledger lets every server on a network report into one audit trail — which is exactly what makes cross-server correlation possible.

Pruning

The ledger is bounded by database.max-rows-per-player:

  • Only the newest N rows per player are kept.
  • Older rows are pruned on startup.
  • Set it to 0 for unlimited retention.

This keeps the ledger from growing without bound on a long-lived server. If you want a deep audit trail, raise the number; if you only care about recent behaviour (which is what the detection windows use anyway), the default of 500 is plenty.

Trade-off: max-rows-per-player caps history depth, not detection. The signals work over short rolling windows (minutes), so a low cap doesn't blind them — it only shortens how far back /eg history can look.

Writes

Writes are asynchronous, off the main thread, so recording an event never blocks gameplay. Recording is fire-and-forget from a reporting plugin's point of view — it hands EconGuard a MoneyEvent and returns immediately.

Backups

EconGuard doesn't ship a backup command (the ledger is analysis data, not authoritative balances — the money itself lives in your economy plugin and RoyalBank). If you want to keep the audit trail, copy econguard.db while the server is stopped, or use a plugin/OS-level job that snapshots the file. Don't copy the live .db while the server is running, as the WAL may be mid-write.

Resetting

To wipe the ledger and flags entirely, stop the server and delete econguard.db (and its -wal/-shm siblings). A fresh one is created on next start. To clear only flags without touching the ledger, use /eg flags clear instead.

Clone this wiki locally