-
Notifications
You must be signed in to change notification settings - Fork 6
features transactions
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).
Defined in TxType.java:
| Category | Values |
|---|---|
| Player Payments |
PLAYER_PAY, CHARGE_PAID
|
| Admin |
ADMIN_SET, ADMIN_ADD, ADMIN_REMOVE, ADMIN_RESET
|
| Wallet |
DEPOSIT, WITHDRAW
|
| Notes |
NOTE_WITHDRAW, NOTE_REDEEM
|
| Offline Pay |
OFFLINE_PAY_SENT, OFFLINE_PAY_CLAIMED, OFFLINE_PAY_REFUNDED
|
| Bank |
BANK_DEPOSIT, BANK_WITHDRAW, INTEREST, TAX
|
| Loans |
LOAN_DISBURSE, LOAN_REPAY, LOAN_DEFAULT, LOAN_COLLATERAL_SEIZED
|
| Teams |
TEAM_DEPOSIT, TEAM_WITHDRAW, TEAM_DISBAND_REFUND
|
Each TxRecord carries the fields: txId, serial, instantMs, txType, currencyId, fromUuid, toUuid, amount, worldName, metadata (key/value Map).
record(r) β antiDupeWindow β pending queue (ConcurrentLinkedDeque)
β (flush every 5s Γ 20 ticks or when batchSize=500 is reached)
TransactionLogFlusher thread
β
ββββββββββββββββββββββββββββββββββ
β insertBatch dao (File/MySQL) β
ββββββββββββββββββββββββββββββββββ
β
DailyJsonLogWriter
-
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.
Local persistence without dependencies. Useful for backups, development, or small servers.
Requires storage.use_mysql: true. Table automatically created by Database.ensureSchema():
CREATE TABLE IF NOT EXISTS vault_transactions (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
tx_id VARCHAR(64) UNIQUE,
serial BIGINT UNIQUE,
ts TIMESTAMP,
tx_type VARCHAR(32),
currency_id VARCHAR(32) DEFAULT 'default',
from_uuid CHAR(36),
to_uuid CHAR(36),
amount DECIMAL(19,4),
world_name VARCHAR(64),
metadata_json TEXT
);Automatic indexes: idx_vt_from, idx_vt_to, idx_vt_ts, idx_vt_currency.
DailyJsonLogWriter creates one file per day at plugins/Vault/logs/daily-yyyy-MM-dd.json:
{"txId":"...","serial":42,"txType":"PLAYER_PAY","from":"...","to":"...","amount":100.0,...}A new file is opened automatically when crossing midnight. Each flusher batch is appended to the current day.
Permission vault.history (default true). Opens HistoryMenuService with a 54-slot inventory and 45 transactions per page:
| Slot | Function |
|---|---|
| 0β44 | FILLED_MAP / MAP items per transaction |
| 45 | Previous page |
| 49 | Info (page / total) |
| 50 | Close |
| 53 | Next 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%
Independent of the log, stores pending charges for offline players:
CREATE TABLE IF NOT EXISTS vault_charge_requests (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
recipient VARCHAR(16),
sender VARCHAR(16),
amount DECIMAL(19,4),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
INDEX idx_vcr_recipient (recipient)
);
Vault Economy v2.1.0 Β· Compatible with Spigot 1.8.8 β 1.21.x
π¦ Modrinth Β·
π¬ Discord Β·
Java 17 (legacy) Β· Java 21 (modern)
Documentation generated on 2026-09-03 Β· Vault Project Team
- π Home
- π First Install
- π§βπ« Getting Started
- β Basic FAQ
- π Formats and Localization
- π± Multi-currency
- π’ Abbreviation (k / M / B / T)
- π Complete Command List
- π‘οΈ Complete Permission List
- βοΈ config.yml Reference
- π Supported Languages
- π Modrinth Updates
- π° Player-to-Player Payments
- π¦ Bank System
- π΅ Physical Notes
- πΈ Loans
- π Transaction History
- π Top Players
- βΈοΈ Offline Payments
- π³ Charges / Payment Requests
- π Discord Webhook
- π οΈ Installation Errors
- π« Players Can't Pay
- 𧨠Balances Wiped on Restart
- π Bank Doesn't Pay Interest
- π§Ύ Invalid / Expired Notes
- π©Ί Complete Step-by-Step Troubleshooting
- πΊοΈ Separate Balances Per World
- π Migration from EssentialsX
- π PlaceholderAPI (25+ placeholders)
- π€ SkinsRestorer Β· GUI Heads
- π LuckPerms
- ποΈ MySQL / HikariCP
-
Java API
- π¬ Getting Started
- π‘ Events and Transactions
- π SimpleEconomy Hooks
- π Skript
- π§° Contribute Β· Dual Maven Build
- π Changelog v2.1.0
- π Support