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:
AntiDupeWindowbased onserial+txId. Duplicates triggerfireDupe()(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)
Requiresstorage.use_mysql: true. Table automatically created by Database.ensureSchema():
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:
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%
