EconomyCraft
适用于 Fabric 和 NeoForge 的服务器端经济系统。
附加组件: EconomyCraft Bounties
/eco 菜单
| 按钮 |
描述 |
| 商店 (Shop) |
以固定价格购买或出售商品,库存无限。左键点击为购买,右键点击为出售,Shift+点击使用批量数量。 |
| 拍卖行 (Auction House) |
购买其他玩家挂售的物品,或挂售你自己的物品。 |
| 出售物品 (Sell Items) |
放入物品,检查总价并确认。未定价的物品无法出售。损坏的物品售价较低,附魔的物品售价较高。 |
| 订单 (Orders) |
请求获取指定物品、数量和价格。其他玩家完成订单后即可获得报酬。 |
| 每日奖励 (Daily Reward) |
领取每日奖励,每天仅限一次。 |
| 支付玩家 (Pay a Player) |
向其他玩家转账。 |
| 排行榜 (Leaderboards) |
余额榜、收入榜、支出榜、卖家榜、买家榜以及交易榜。 |
| 物品价值 (Item Value) |
任意物品的购买价格和出售价格。 |
| 投递 (Deliveries) |
因背包已满或离线时已完成而无法直接交付的物品或款项。 |
| 交易记录 (Transactions) |
你最近的余额历史记录。 |
每个屏幕也对应一个命令:/bal、/pay、/daily、/shop、/ah、/auction、/sell、/worth、/orders、/deliveries、/transactions。
在命令和菜单中,金额支持简写格式:500、1.5k、20M、3B、2T、2.5Qa、1Qi。
管理员 (/eco admin) 菜单
商店编辑器
浏览分类并点击物品以进行编辑。
- 分类编辑器:右键点击分类以重命名、更改颜色、图标或可见性,或将其排除在动态定价之外。删除一个分类会将其中的物品移至
misc 并将它们的购买价格归零。
- 添加物品:选择游戏中的任意物品,或你背包中的物品。自定义名称、附魔和容器内容均会被保留。
- 购买价格 / 出售价格:单个物品的价格;设为
0 将禁用该方向的交易。如果启用了动态定价,此处还会显示当前价格和乘数。
- 动态定价:即使服务器全局启用了动态定价,也可将此物品排除在外。
- 批量数量:按住 Shift 键点击时购买或出售的数量。
- 分类:物品所在的商店页面。
blocks.wood 会创建一个子页面。
- 移除:将物品从商店中移除。其价格会被保留。
- 已移除物品:所有被移除的物品。点击其中一个可将其放回并恢复旧价格。通过添加物品功能重新添加已移除物品也会执行相同操作。
动态商店定价
可选功能,默认关闭(dynamic_prices.enabled)。将所有购买价格按以下公式缩放:
当前价格 = 基础价格 × 在线玩家的中位数余额 / 起始余额
缩放比例限制在 dynamic_prices.min_multiplier 和 dynamic_prices.max_multiplier 之间,并每隔 dynamic_prices.update_minutes 重新计算一次(默认为每小时一次)。出售价格不受影响。可在上方的商店编辑器中按分类或物品排除动态定价。
设置
config.json 中的每个选项均可在游戏中编辑,并按与配置文件相同的类别进行分组。
玩家
选择任意玩家(在线或离线),为其给予、扣除或设定余额,将其从经济系统中移除,或覆盖其最大活跃订单/拍卖数量。
重置工具
| 工具 |
功能 |
| 重置所有余额 |
将每位玩家的余额重置为 economy.starting_balance。 |
| 重置每日奖励数据 |
所有人可以立即重新领取每日奖励。 |
| 重置每日出售限制 |
所有人的每日出售限制立即恢复满额。 |
| 清除拍卖 |
取消所有进行中的挂牌。物品将退回给卖家的交付处。 |
| 清除订单 |
取消所有未完成的订单。托管资金将退还给请求者。 |
| 移除所有物品 |
移除所有商店物品,效果等同于商店编辑器中的 Remove(移除)。从 Removed items(已移除物品) 中取回物品。 |
| 重置商店价格 |
用默认值替换 prices.json,包括分类。自定义物品将被删除。旧文件会保留为 prices.json.before-reset-<time>。 |
| 重置整个经济系统 |
执行上述除两个商店工具之外的所有操作,同时清除排行榜统计数据并删除全部交易日志。 |
仅有这两个商店工具会影响商店价格和分类。它们均不会修改权限设置。
管理员命令
/eco addmoney、/eco setmoney、/eco removemoney、/eco removeplayer。
权限
管理员及命令访问权限由权限节点控制。若任何管理员节点未被权限插件设置,则回退至 OP(管理员)状态;若任何命令节点未设置,则默认为允许所有人使用。
管理员节点
| 节点 |
权限 |
economycraft.admin |
包含以下所有权限 |
economycraft.admin.players |
/eco addmoney, /eco setmoney, /eco removemoney, /eco removeplayer,以及玩家界面 |
economycraft.admin.settings |
设置界面 |
economycraft.admin.shop |
商店编辑器(来自管理员菜单或商店内的编辑按钮) |
economycraft.admin.reload |
“从磁盘重新加载”按钮 |
economycraft.admin.reset |
重置工具界面 |
命令节点
| 节点 |
授予权限 |
economycraft.command.menu |
/eco, /eco menu |
economycraft.command.balance |
/bal |
economycraft.command.pay |
/pay |
economycraft.command.shop |
/shop |
economycraft.command.auction |
/ah, /auction |
economycraft.command.sell |
/sell |
economycraft.command.orders |
/orders |
economycraft.command.deliveries |
/deliveries |
economycraft.command.daily |
/daily |
economycraft.command.transactions |
/transactions |
economycraft.command.worth |
/worth |
配置文件
在服务器上存储于 config/economycraft/(或在单人模式中每个世界存储于 saves/<world>/economycraft/):顶层文件包括 config.json、webhook.json 和 prices.json,玩家数据位于 data/ 目录下。
config.json
| 键 |
默认值 |
描述 |
economy.starting_balance |
1000 |
新玩家初始拥有的金钱。 |
economy.max_balance |
1000000000000000000 |
单个玩家最多可持有的金额,从 1 到 $1Qi(即 $1,000,000,000,000,000,000$)。 |
economy.daily_reward |
100 |
每日奖励所给予的金钱。 |
economy.tax_rate |
0.1 |
交易和订单的税率,以小数表示(0.1 = 10%)。 |
display.balance_separator |
"." |
千位分隔符,例如使用 "," 则显示为 $1,000。 |
display.currency_symbol |
"$" |
每个金额旁显示的符号,最长 16 个字符。设为 "" 则不显示任何符号。 |
display.currency_symbol_position |
"prefix" |
设置为 "prefix" 时显示 $100;设置为 "suffix" 时显示 100$。 |
display.currency_name |
"" |
可选名称,用于在聊天消息中替代符号显示,例如设为 "Gold" 则显示为 100 Gold。菜单中仍保留符号。 |
display.scoreboard_enabled |
true |
是否在记分板侧边栏显示余额。 |
commands.standalone |
true |
允许直接使用 /pay、/daily 等命令,无需加上 /eco 前缀。 |
commands.standalone_admin |
false |
允许直接使用 /addmoney、/setmoney 等管理命令,无需加上 /eco 前缀。 |
shop.enabled |
true |
启用固定价格商店。 |
selling.enabled |
true |
启用出售功能。 |
selling.daily_limit |
10000 |
玩家每天通过出售物品最多可获得的金额。设为 0 则取消此限制。 |
selling.worth_enabled |
true |
启用物品价值查询功能(使用 /worth 命令)。 |
dynamic_prices.enabled |
false |
根据在线玩家的平均余额动态调整商店购买价格。详见 动态商店定价。 |
dynamic_prices.min_multiplier |
0.5 |
允许的最低价格缩放倍数,范围从 0.5 到 100。 |
dynamic_prices.max_multiplier |
5.0 |
允许的最高价格缩放倍数,范围从 0.5 到 100。 |
dynamic_prices.min_active_days |
30 |
玩家必须在此天数内登录过才算作“活跃”。设为 0 则包含所有玩家。 |
dynamic_prices.update_minutes |
60 |
重新计算价格缩放倍数的时间间隔(分钟)。最小值为 1。 |
auction.enabled |
true |
启用拍卖行。 |
auction.expiration_hours |
168 |
未售出的拍卖品在过期后转入投递箱的小时数。设为 0 则不过期。 |
auction.max_active_per_player |
0 |
玩家同时可持有的活跃拍卖品数量上限。设为 0 表示无限制。支持按玩家单独覆盖设置。 |
orders.enabled |
true |
启用订单板。无论是否启用,投递功能均正常工作。 |
orders.expiration_hours |
168 |
未完成订单在过期并退还托管资金之前的小时数。设为 0 则不过期。 |
orders.max_active_per_player |
0 |
玩家同时可持有的开放订单数量上限。设为 0 表示无限制。支持按玩家单独覆盖设置。 |
transaction_log.enabled |
true |
记录每笔余额变动至每日日志文件。 |
transaction_log.retention_days |
7 |
保留交易日志的天数。 |
webhook.json
| 键 |
默认值 |
描述 |
webhook_enabled |
false |
将交易记录发送至 webhook_url。 |
webhook_url |
"" |
Discord 兼容的入站 Webhook URL。 |
webhook_min_amount |
0 |
跳过小于此金额的交易的 Webhook 推送。 |
prices.json
每项商店商品对应一个条目,以物品 ID 为键:
{
"minecraft:diamond": {
"category": "ores",
"stack": 64,
"unit_buy": 800,
"unit_sell": 200
}
}
category 接受 top.sub 格式以指向子页面,stack 为点击 Shift 时的批量数量,而 unit_buy/unit_sell 则是单个物品的价格(设为 0 即禁用该方向)。已安装的模组提供的物品会自动添加,使用其模组 ID 作为分类,且两项价格均默认为 0。
编辑器还会写入一些额外的键:
components: 自定义物品的 NBT 数据(名称、附魔、容器内容等)。通过 #label 后缀来区分相同物品的不同实例,例如 minecraft:shulker_box#loot_rare。
"removed": true: 将物品从商店中移除但保留其其他键值,以便可以从 已移除物品 中恢复。删除 removed 键即可将其重新放回。
"dynamic_price_enabled": false: 使某个物品或 _categories 下的整个分类退出动态定价模式。
占位符
通过 Text Placeholder API(Fabric)或 Placeholder API NeoForge(NeoForge)向其他模组暴露经济数据。两者均为可选模块,模组本身无需它们也能运行,但必须将对应的 jar 文件放入 mods/ 目录才能使占位符生效。
| 占位符 |
描述 |
%economycraft:balance% |
原始余额,例如 1000。 |
%economycraft:balance_formatted% |
格式化后的余额,例如 $1.000。 |
%economycraft:balance_short% |
缩写形式的余额,例如 $1.2k。 |
%economycraft:daily_sell_remaining% |
今日玩家仍可出售获得的金额。若无限则为 ∞。 |
%economycraft:top_name <rank>% |
指定排名玩家的名称(1 = 最富有者)。 |
%economycraft:top_balance <rank>% |
指定排名的原始余额。 |
%economycraft:top_balance_formatted <rank>% |
指定排名的格式化余额。 |
%economycraft:top_balance_short <rank>% |
指定排名的缩写余额。 |
超出实际玩家数量的排名会被解析为无效。
交易日志与 Webhook
每笔余额变动都会记录在配置文件夹内的 logs/transactions-YYYY-MM-DD.log 文件中,并保留 transaction_log.retention_days 天(默认值为 7)。若将该值设置为超过 90,启动时会在控制台输出警告信息。
在 webhook.json 中启用 webhook_enabled 可将每笔交易 POST 至兼容 Discord 的 Webhook;可通过 webhook_min_amount 设置仅对较大金额的交易发送通知。
开发者 API
标准的 EconomyCraft jar 包包含了供其他服务端模组使用的 v1 版 API,无需单独安装运行时 API 模组。涵盖余额与支付、货币格式化、只读物品价格、排行榜数据以及余额变更事件。公共类位于 com.reazip.economycraft.api.v1 下。
有关设置、示例及完整参考文档,请参阅 Developer API wiki。
EconomyCraft
A server-side economy for Fabric and NeoForge.
Add-On: EconomyCraft Bounties
The /eco menu
| Buttom |
Description |
| Shop |
Buy and sell at fixed prices with unlimited stock. Left click buys, right click sells, shift-click uses the bulk amount. |
| Auction House |
Buy items other players have listed, or list your own. |
| Sell Items |
Drop items in, check the total, confirm. Unpriced items can't be sold. Damaged items sell for less, enchanted for more. |
| Orders |
Request an item, amount and price. Other players fill it and get paid. |
| Daily Reward |
Claims the daily payout, once per day. |
| Pay a Player |
Send money to another player. |
| Leaderboards |
Top Balances, Earners, Spenders, Sellers, Buyers and Traders. |
| Item Value |
The buy and sell price of any item. |
| Deliveries |
Items or payouts that couldn't be delivered directly (full inventory/completed while offline). |
| Transactions |
Your recent balance history. |
Each screen also has a command: /bal, /pay, /daily, /shop, /ah, /auction, /sell, /worth, /orders, /deliveries, /transactions.
Money amounts accept shorthand in commands and menus: 500, 1.5k, 20M, 3B, 2T, 2.5Qa, 1Qi.
The Admin (/eco admin) menu
Shop editor
Browse categories and click an item to edit it.
- Category editor: right-click a category to rename it, change its color, icon or visibility, or exclude it from dynamic pricing. Deleting a category moves its items to
misc and zeroes their buy prices.
- Add item: pick any item in the game, or one from your inventory. Custom names, enchantments and container contents are kept.
- Buy Price / Sell Price: the price of one item;
0 disables that direction. If dynamic pricing applies, this also shows the current price and multiplier.
- Dynamic Pricing: opt this item out of dynamic pricing even while it's enabled server-wide.
- Bulk Amount: how many a shift-click buys or sells.
- Category: which shop page the item appears on.
blocks.wood creates a sub-page.
- Remove: takes the item out of the shop. Its price is kept.
- Removed items: every removed item. Click one to put it back with its old price. Adding a removed item through Add item does the same.
Dynamic shop pricing
Optional, off by default (dynamic_prices.enabled). Scales every buy price by:
current price = base price × active-player median balance / starting balance
The scale is clamped between dynamic_prices.min_multiplier and dynamic_prices.max_multiplier, and recalculated every dynamic_prices.update_minutes (default once an hour). Sell prices are never affected. Opt out per category or item from the Shop editor above.
Settings
Every option in config.json, editable in-game and grouped into the same categories as the file.
Players
Select any player, online or not, to give, take or set their balance, remove them from the economy, or override their max active orders/auctions.
Reset Tools
| Tool |
Does |
| Reset All Balances |
Sets every player's balance back to economy.starting_balance. |
| Reset Daily Reward Data |
Everyone can claim their daily reward again immediately. |
| Reset Daily Sell Limits |
Everyone's daily sell limit resets to full immediately. |
| Clear Auctions |
Cancels every active listing. Items are returned to sellers' deliveries. |
| Clear Orders |
Cancels every open order. Escrowed money is refunded to requesters. |
| Remove All Items |
Removes every shop item, the same as Remove in the Shop editor. Put items back from Removed items. |
| Reset Shop Prices |
Replaces prices.json with the defaults, including categories. Custom items are deleted. The old file is kept as prices.json.before-reset-<time>. |
| Reset Entire Economy |
Every tool above except the two shop tools, plus wipes the Leaderboards stats and deletes the entire transaction log. |
Only the two shop tools touch shop prices/categories. None of them touch permission settings.
Admin commands
/eco addmoney, /eco setmoney, /eco removemoney, /eco removeplayer.
Permissions
Admin and command access is gated by permission nodes. Any admin node not set by a permission plugin falls back to OP; any command node not set falls back to allowed for everyone.
Admin nodes
| Node |
Grants |
economycraft.admin |
Everything below |
economycraft.admin.players |
/eco addmoney, /eco setmoney, /eco removemoney, /eco removeplayer, the Players screen |
economycraft.admin.settings |
The Settings screen |
economycraft.admin.shop |
The Shop editor (from the Admin menu or the in-shop edit button) |
economycraft.admin.reload |
The "Reload from disk" button |
economycraft.admin.reset |
The Reset Tools screen |
Command nodes
| Node |
Grants |
economycraft.command.menu |
/eco, /eco menu |
economycraft.command.balance |
/bal |
economycraft.command.pay |
/pay |
economycraft.command.shop |
/shop |
economycraft.command.auction |
/ah, /auction |
economycraft.command.sell |
/sell |
economycraft.command.orders |
/orders |
economycraft.command.deliveries |
/deliveries |
economycraft.command.daily |
/daily |
economycraft.command.transactions |
/transactions |
economycraft.command.worth |
/worth |
Config files
Stored in config/economycraft/ on a server (or saves/<world>/economycraft/ per-world in singleplayer): config.json, webhook.json and prices.json at the top, player data under data/.
config.json
| Key |
Default |
Description |
economy.starting_balance |
1000 |
Money new players start with. |
economy.max_balance |
1000000000000000000 |
Most money one player can hold, from 1 up to $1Qi. |
economy.daily_reward |
100 |
Money given by the daily reward. |
economy.tax_rate |
0.1 |
Tax on trades and orders, as a decimal (0.1 = 10%). |
display.balance_separator |
"." |
Thousands separator, e.g. "," gives $1,000. |
display.currency_symbol |
"$" |
Symbol shown with every amount, up to 16 characters. "" for none. |
display.currency_symbol_position |
"prefix" |
"prefix" gives $100, "suffix" gives 100$. |
display.currency_name |
"" |
Optional name used instead of the symbol in chat messages, e.g. "Gold" gives 100 Gold. Menus keep the symbol. |
display.scoreboard_enabled |
true |
Show the balance sidebar. |
commands.standalone |
true |
Allow /pay, /daily etc. without the /eco prefix. |
commands.standalone_admin |
false |
Allow /addmoney, /setmoney etc. without the /eco prefix. |
shop.enabled |
true |
Enable the fixed-price shop. |
selling.enabled |
true |
Enable selling. |
selling.daily_limit |
10000 |
Most a player can earn per day from selling. 0 disables the limit. |
selling.worth_enabled |
true |
Enable item value lookups (/worth). |
dynamic_prices.enabled |
false |
Scale shop buy prices with the active-player median balance. See Dynamic shop pricing. |
dynamic_prices.min_multiplier |
0.5 |
Lowest allowed price scale, from 0.5 to 100. |
dynamic_prices.max_multiplier |
5.0 |
Highest allowed price scale, from 0.5 to 100. |
dynamic_prices.min_active_days |
30 |
Players must have logged in within this many days to count as active. 0 includes everyone. |
dynamic_prices.update_minutes |
60 |
Minutes between price scale recalculations. Minimum 1. |
auction.enabled |
true |
Enable the auction house. |
auction.expiration_hours |
168 |
Hours before an unsold auction expires and its item goes to deliveries. 0 disables expiration. |
auction.max_active_per_player |
0 |
Most active auctions a player can have at once. 0 = unlimited. Overridable per player. |
orders.enabled |
true |
Enable the orders board. Deliveries still work either way. |
orders.expiration_hours |
168 |
Hours before an unfulfilled order expires and its escrow is refunded. 0 disables expiration. |
orders.max_active_per_player |
0 |
Most open orders a player can have at once. 0 = unlimited. Overridable per player. |
transaction_log.enabled |
true |
Record every balance change to a daily log file. |
transaction_log.retention_days |
7 |
How many days of transaction logs to keep. |
webhook.json
| Key |
Default |
Description |
webhook_enabled |
false |
Post transactions to webhook_url. |
webhook_url |
"" |
Discord-compatible incoming webhook URL. |
webhook_min_amount |
0 |
Skip webhook posts for transactions smaller than this. |
prices.json
One entry per shop item, keyed by item id:
{
"minecraft:diamond": {
"category": "ores",
"stack": 64,
"unit_buy": 800,
"unit_sell": 200
}
}
category accepts top.sub for a sub-page, stack is the shift-click bulk amount, and unit_buy/unit_sell are the price of one item (0 disables that direction). Items from installed mods are added automatically, using their mod ID as category and 0 for both prices.
The editor also writes a few extra keys:
components: NBT for custom items (name, enchantments, container contents). A #label suffix distinguishes duplicates of the same item, e.g. minecraft:shulker_box#loot_rare.
"removed": true: takes the item out of the shop but keeps its other keys, so it can be put back from Removed items. Delete the removed key to put it back.
"dynamic_price_enabled": false: opts an item, or a category under _categories, out of dynamic pricing.
Placeholders
Exposes economy data to other mods via Text Placeholder API (Fabric) or Placeholder API NeoForge (NeoForge). Both are optional, the mod works without them, but the matching jar must be in mods/ for placeholders to resolve.
| Placeholder |
Description |
%economycraft:balance% |
Raw balance, e.g. 1000. |
%economycraft:balance_formatted% |
Formatted balance, e.g. $1.000. |
%economycraft:balance_short% |
Abbreviated balance, e.g. $1.2k. |
%economycraft:daily_sell_remaining% |
How much the player can still earn from selling today. ∞ if unlimited. |
%economycraft:top_name <rank>% |
Name of the player at that rank (1 = richest). |
%economycraft:top_balance <rank>% |
Raw balance at that rank. |
%economycraft:top_balance_formatted <rank>% |
Formatted balance at that rank. |
%economycraft:top_balance_short <rank>% |
Abbreviated balance at that rank. |
Ranks beyond the number of players resolve as invalid.
Transaction logs and webhook
Every balance change is logged to logs/transactions-YYYY-MM-DD.log inside the config folder, and kept for transaction_log.retention_days days (default 7). Setting it above 90 logs a console warning on start.
Enable webhook_enabled in webhook.json to also POST each transaction to a Discord-compatible webhook; use webhook_min_amount to only notify on larger transactions.
Developer API
The normal EconomyCraft jar includes API v1 for other server-side mods, no separate runtime API mod to install. Covers balances and payments, money formatting, read-only item prices, leaderboard data and balance-change events. Public classes are under com.reazip.economycraft.api.v1.
See the Developer API wiki for setup, examples and the complete reference.
评论 0
登录后参与评分
还没有评论,来抢沙发吧