Vault3
繁體中文 · English

适用于 Spigot 和 Paper 的完整经济系统,将自己注册为 Vault 经济提供者。那些 depend: [Vault] 并调用 net.milkbowl.vault.economy.Economy 的插件将继续像以前一样工作——你不需要与之一起安装 Vault.jar。
为何需要另一个经济插件
大多数经济插件在服务器负载不高时都表现良好,直到你的服务器变得繁忙。Vault3 围绕两个在实际大规模运行时真正会出问题的方面构建:主线程阻塞和资金丢失。
绝不触碰主线程
交易仅标记账户为脏状态并立即返回。写入操作是异步的、经过去抖动处理的,并且仅针对实际发生变化的余额进行——绝不会涉及整个表。
在拥有 200 名玩家的服务器上,一次商店购买原本意味着服务器等待数据库完成 200 行的批量更新插入(upsert)。而现在它只意味着一行数据,且在非主线程上执行。
交易具有原子性
withdrawPlayer 和 depositPlayer 是对账户执行的单个原子操作。当两个插件同时访问同一余额时——例如商店和每日奖励任务——它们无法互相覆盖对方。在 20 万并发提现的 8 线程压力测试下,最终余额精确到分。
你的数据能度过糟糕的一天
- 干净关闭:在连接池关闭之前同步写入所有余额,并重试失败的写入三次。
- 数据库不可达? 余额会被转储到
balances-emergency-<timestamp>.yml 中,而不是丢失。
- 下次启动 会自动应用该转储文件,将其写回 MySQL 并归档,以确保其永远不会被应用两次。如果数据库仍然宕机,该文件将被保留以用于随后的尝试。
功能
|
|
| 存储 |
MySQL (HikariCP) 或平面文件。驱动程序在运行时下载,无需捆绑任何东西。 |
| 支付 |
/pay 配合分页玩家选择 GUI,或直接使用 /pay <player> <amount>。 |
| 收费请求 |
向玩家请求金钱。离线目标将在下次登录时收到请求。 |
| 贷款 |
可选的贷款系统,支持分期付款、间隔扣款和可配置的惩罚。 |
| 排行榜 |
/vaultop 支持分页。 |
| 管理 |
/eco give|take,游戏内配置编辑器 GUI,/vault reload。 |
| PlaceholderAPI |
两个扩展包,%vault_*% 和 %vault3_*%。 |
| 语言 |
English, 繁體中文, 简体中文, Español, Français, Deutsch, Nederlands, Polski, Português, Русский, हिन्दी |
| 货币 |
符号、前缀/后缀位置、小数点模式以及 1.2k / 3.4m 缩写。 |
| 导入 |
一次性从 Essentials userdata 导入。 |
命令
| Command |
Description |
Permission |
/balance |
显示你的余额 |
vault.balance |
/pay [player] [amount] |
支付给一名玩家,或打开支付菜单 |
vault.pay |
/vaultop [page] |
最富有的玩家 |
vault.top |
/eco give|take <player> <amount> |
调整余额 |
vault.eco |
/vault [reload|loan] |
主菜单和管理操作 |
vault.admin |
/loan |
贷款菜单 |
vault.loan |
占位符
%vault_balance% %vault_balance_formatted%
%vault_eco_balance_short% %vault_eco_balance_commas%
%vault_ecobalance<0-8>dp% %vault_currency_symbol%
%vault_balance_<player>% %vault_balance_formatted_<player>%
%vault_top% %vault_top_name_<n>% %vault_top_amount_<n>%
设置
- 将 jar 文件放入
plugins/ 目录并启动服务器。
- 打开
plugins/Vault/config.yml,设置你的语言和货币。
- 对于 MySQL,设置
storage.use_mysql: true 并填写连接详细信息。
有两个配置键容易出错,且出错时会静默失败——插件会回退到默认值而不会报错:
storage:
mysql:
# 键名是 "params",而不是 "properties"
params: useSSL=false&serverTimezone=UTC
# 这些必须嵌套在 "pool:" 之下,而不是平铺在 "mysql:" 之下
pool:
max: 10
min_idle: 2
connection_timeout_ms: 10000
调整持久性
storage:
save_on_transaction: true # 每次交易后不久即持久化
transaction_flush_delay_ticks: 20 # 去抖动窗口;越低越安全,但写入更多
autosave_seconds: 60 # 周期性安全网
recover_emergency_dumps: true # 如果多个服务器共享同一个数据库,请设为 false
使用默认设置,意外的进程终止最多只会丢失大约一秒钟的交易数据。
兼容性
- 服务器: Spigot / Paper。提供了 Java 21 和 Java 17 的构建版本。
- 可选挂钩: PlaceholderAPI, LuckPerms, SkinsRestorer, Essentials (仅限导入)。
- 不要同时安装
Vault.jar —— 两者都会注册插件名称 Vault,其中一个将无法加载。
繁體中文
Vault3 是相容 Vault API 的獨立經濟插件,會直接註冊成 Vault 的經濟提供者,
其他插件的 depend: [Vault] 照常運作,不需要另外安裝 Vault.jar。
設計重點
- 交易不碰主執行緒:只標記變更並立即返回,寫入為非同步、去抖動,且只寫變動過的餘額
- 交易具原子性:兩個插件同時操作同一個帳戶不會互相覆寫
- 關服完整存檔:同步寫入全部餘額並重試三次
- 資料庫不可用時:寫出
balances-emergency-<時間戳>.yml,下次啟動自動補寫回資料庫並封存
支援 MySQL 或平面檔、GUI 付款選單、請款、貸款系統、富豪榜、PlaceholderAPI 與 11 種語言。
設定檔有兩個鍵名容易寫錯且不會報錯:連線參數是 params 而非 properties;
連線池參數必須巢狀在 pool: 底下。寫錯會靜默套用預設值。
Vault3
繁體中文 · English

A complete economy system for Spigot and Paper that registers itself as the Vault economy
provider. Plugins that depend: [Vault] and call net.milkbowl.vault.economy.Economy
keep working exactly as before — you do not need to install Vault.jar alongside it.
Why another economy plugin
Most economy plugins are fine until your server gets busy. Vault3 is built around the two
things that actually break at scale: main-thread blocking and losing money.
Nothing touches the main thread
A transaction marks the account dirty and returns. Writes happen asynchronously, debounced,
and only for the balances that actually changed — never the whole table.
On a 200-player server, a shop purchase used to mean a 200-row batch upsert while the server
waited on the database. Now it means one row, off-thread.
Transactions are atomic
withdrawPlayer and depositPlayer are single atomic operations on the account. Two plugins
hitting the same balance at the same time — a shop and a daily-reward task, for example —
cannot overwrite each other. Under an 8-thread stress test of 200,000 concurrent withdrawals,
the final balance is exact to the cent.
Your data survives a bad day
- Clean shutdown writes every balance synchronously before the connection pool closes,
and retries a failed write three times.
- Database unreachable? Balances are dumped to
balances-emergency-<timestamp>.yml
instead of being lost.
- Next startup automatically applies that dump, writes it back to MySQL, and archives it
so it can never be applied twice. If the database is still down, the file is kept for the
attempt after that.
Features
|
|
| Storage |
MySQL (HikariCP) or flat file. Drivers are downloaded at runtime, nothing to bundle. |
| Payments |
/pay with a paginated player-picker GUI, or direct /pay <player> <amount>. |
| Charge requests |
Request money from a player. Offline targets get the request on their next join. |
| Loans |
Optional loan system with installments, interval charging and configurable penalties. |
| Leaderboard |
/vaultop with pagination. |
| Admin |
/eco give|take, in-game config editor GUI, /vault reload. |
| PlaceholderAPI |
Two expansions, %vault_*% and %vault3_*%. |
| Languages |
English, 繁體中文, 简体中文, Español, Français, Deutsch, Nederlands, Polski, Português, Русский, हिन्दी |
| Currency |
Symbol, prefix/suffix position, decimal pattern, and 1.2k / 3.4m abbreviation. |
| Import |
One-shot import from Essentials userdata. |
Commands
| Command |
Description |
Permission |
/balance |
Show your balance |
vault.balance |
/pay [player] [amount] |
Pay a player, or open the payment menu |
vault.pay |
/vaultop [page] |
Richest players |
vault.top |
/eco give|take <player> <amount> |
Adjust a balance |
vault.eco |
/vault [reload|loan] |
Main menu and admin actions |
vault.admin |
/loan |
Loan menu |
vault.loan |
Placeholders
%vault_balance% %vault_balance_formatted%
%vault_eco_balance_short% %vault_eco_balance_commas%
%vault_ecobalance<0-8>dp% %vault_currency_symbol%
%vault_balance_<player>% %vault_balance_formatted_<player>%
%vault_top% %vault_top_name_<n>% %vault_top_amount_<n>%
Setup
- Drop the jar into
plugins/ and start the server.
- Open
plugins/Vault/config.yml, set your language and currency.
- For MySQL, set
storage.use_mysql: true and fill in the connection details.
Two config keys are easy to get wrong, and getting them wrong fails silently — the plugin
falls back to defaults without an error:
storage:
mysql:
# the key is "params", not "properties"
params: useSSL=false&serverTimezone=UTC
# these must be nested under "pool:", not flat under "mysql:"
pool:
max: 10
min_idle: 2
connection_timeout_ms: 10000
Tuning durability
storage:
save_on_transaction: true # persist shortly after each transaction
transaction_flush_delay_ticks: 20 # debounce window; lower = safer, more writes
autosave_seconds: 60 # periodic safety net
recover_emergency_dumps: true # set false if several servers share one database
With the defaults, an unexpected process kill loses at most about one second of transactions.
Compatibility
- Server: Spigot / Paper. Builds for Java 21 and Java 17 are provided.
- Optional hooks: PlaceholderAPI, LuckPerms, SkinsRestorer, Essentials (import only).
- Do not install
Vault.jar as well — both register the plugin name Vault and one of
them will fail to load.
繁體中文
Vault3 是相容 Vault API 的獨立經濟插件,會直接註冊成 Vault 的經濟提供者,
其他插件的 depend: [Vault] 照常運作,不需要另外安裝 Vault.jar。
設計重點
- 交易不碰主執行緒:只標記變更並立即返回,寫入為非同步、去抖動,且只寫變動過的餘額
- 交易具原子性:兩個插件同時操作同一個帳戶不會互相覆寫
- 關服完整存檔:同步寫入全部餘額並重試三次
- 資料庫不可用時:寫出
balances-emergency-<時間戳>.yml,下次啟動自動補寫回資料庫並封存
支援 MySQL 或平面檔、GUI 付款選單、請款、貸款系統、富豪榜、PlaceholderAPI 與 11 種語言。
設定檔有兩個鍵名容易寫錯且不會報錯:連線參數是 params 而非 properties;
連線池參數必須巢狀在 pool: 底下。寫錯會靜默套用預設值。
评论 0
登录后参与评分
还没有评论,来抢沙发吧