Skip to main content

Transaction Log

TransactionLogService records every economic operation of the plugin. It uses an asynchronous queue architecture with anti-duplicate support and two persistence backends: YAML file (FileTxDAO) or MySQL (MySqlTxDAO).

TxType Enum — 24 Actual Values

Defined in TxType.java: Each TxRecord carries the fields: txId, serial, instantMs, txType, currencyId, fromUuid, toUuid, amount, worldName, metadata (key/value Map).

Asynchronous Write Architecture

  • Anti-dupe window: AntiDupeWindow based on serial + txId. Duplicates trigger fireDupe() (subscribers include Discord webhook).
  • Batch size: 500 records; reaching this threshold forces an immediate flush.
  • Dedicated thread: VaultTxFlusher (SingleThreadExecutor, daemon).
  • Retry: if DAO write fails, records are re-queued at the front for later retry.

Persistence Backends

FileTxDAO (YAML files)

Local persistence without dependencies. Useful for backups, development, or small servers.

MySqlTxDAO (MySQL)

Requires storage.use_mysql: true. Table automatically created by Database.ensureSchema():
Automatic indexes: idx_vt_from, idx_vt_to, idx_vt_ts, idx_vt_currency.

Daily JSON Logs

DailyJsonLogWriter creates one file per day at plugins/Vault/logs/daily-yyyy-MM-dd.json:
A new file is opened automatically when crossing midnight. Each flusher batch is appended to the current day.

History GUI: /vault history

Permission vault.history (default true). Opens HistoryMenuService with a 54-slot inventory and 45 transactions per page: Each item shows:
  • Color/title by direction: incoming (+), outgoing (-), neutral (admin set)
  • Lore with txId (12 chars), from/to, world, date dd/MM/yyyy HH:mm, metadata
  • Placeholders %sign% %amount% %currency% %txid% %time%

vault_charge_requests Table (MySQL)

Independent of the log, stores pending charges for offline players: