Viper Economy
Viper Economy 是一款适用于 Minecraft 1.21.x、26.1.x、26.2.x 和 26.3.x 的服务端 Fabric 经济模组。它添加了虚拟或实体货币、服务器商店图形界面、玩家储物箱商店、玩家间转账以及可购买的指令奖励(领地块、等级、套装)。无需客户端模组:原版客户端可以加入并使用所有功能,该模组也支持单人游戏。
功能
- 虚拟货币(按玩家存储数字余额)或实体货币(如钻石等物品作为货币)。
- 服务器商店图形界面,包含分类、分页、单项买卖价格、Shift+点击批量买卖以及可配置的交易税。
- 玩家储物箱商店:在储物箱上放置告示牌即可出售其中的物品,并具有所有权保护,其他玩家无法打开商店储物箱。
- 玩家间转账、余额排行榜以及手持物品价格查询。
- 指令奖励:任何商店条目均可在购买时运行控制台指令,例如给予领地块或 LuckPerms 等级,可选择是否交付实体物品。
- 新账户自动获得配置的初始余额。余额会在每次更改及服务器关闭时保存到磁盘。
- 每日出售收入上限,以减缓通货膨胀。
命令
玩家命令
| 命令 |
权限节点 |
描述 |
/bal [player] |
viper-economy.command.bal(检查其他玩家需 viper-economy.command.bal.others) |
显示你的余额,或其他在线玩家的余额 |
/pay <player> <amount> |
viper-economy.command.pay |
从你的余额向另一名玩家发送金钱 |
/baltop |
viper-economy.command.baltop |
显示前 10 名余额 |
/withdraw <amount> |
viper-economy.command.withdraw |
将余额转换为实体货币物品(仅限实体模式) |
/topup <amount> |
viper-economy.command.baltop |
将背包中的实体货币物品转换为余额(仅限实体模式) |
/worth |
viper-economy.command.worth |
显示主手物品的商店买入和卖出价格 |
/buy <item> [amount] |
viper-economy.command.buy |
通过 ID 从服务器商店购买物品,例如 /buy minecraft:diamond 5 |
/sell <item> [amount] |
viper-economy.command.sell |
通过 ID 将物品卖给服务器商店 |
/sell hand [amount] |
viper-economy.command.sell |
出售主手中的物品堆,可选限制数量 |
/sell all [amount] |
viper-economy.command.sell |
出售背包中所有匹配类型的物品 |
/servershop |
viper-economy.command.servershop |
打开服务器商店图形界面 |
玩家也可以直接使用商店图形界面:左键单击购买 1 个,Shift+左键单击购买一组,右键单击出售 1 个,Shift+右键单击出售所有该物品。
管理员命令(仅限服务器操作员)
| 命令 |
描述 |
/givemoney <player> <amount> |
向玩家余额中添加金钱 |
/takemoney <player> <amount> |
从玩家余额中扣除金钱(若余额不足则失败) |
/setmoney <player> <amount> |
将玩家余额设置为指定值 |
/resetmoney <player> |
将玩家余额重置为配置的初始余额 |
/ecolog |
显示当前的经济设置及已存储的账户数量 |
配置
所有文件位于服务端的 config/viper-economy/ 目录下。config.json 在首次启动时以默认值创建。prices.json(包含 500 多个条目)在首次启动时自动部署;每个注册的物品都会出现在商店中,未定价的物品仅列为目录项,直到你为其设置价格。
config.json
| 字段 |
默认值 |
描述 |
economyMode |
"VIRTUAL" |
"VIRTUAL" 将余额存储为数字。"PHYSICAL" 改为统计背包中的货币物品数量。 |
physicalCurrencyItem |
"minecraft:diamond" |
当 economyMode 为 "PHYSICAL" 时用作货币的物品 ID。 |
startingBalance |
1000.0 |
新账户首次加入时获得的余额。也可由 /resetmoney 使用。 |
dailyAmount |
100.0 |
保留字段。目前仅由 /ecolog 显示,不会自动发放。 |
dailySellLimit |
10000.0 |
每个玩家每天可赚取的最大总出售价值。适用于商店图形界面和 /sell。 |
taxRate |
0.1 |
每次服务器商店购买时额外增加的比率(0.1 = 10%)。 |
pvpBalanceLossPercentage |
0.0 |
保留字段。目前无效。 |
standaloneCommands |
true |
保留字段。目前无效;命令访问权限由上述权限节点控制(所有节点默认对所有玩家开放,等级 0)。 |
standaloneAdminCommands |
false |
保留字段。目前无效;管理员命令始终需要操作员身份。 |
scoreboardEnabled |
true |
保留字段。目前无效;不渲染计分板。 |
serverShopEnabled |
true |
设置为 false 以禁用 /servershop 和商店图形界面。 |
showAllItemsCategory |
true |
设置为 false 以隐藏 /servershop 中的“所有物品”分类。精选分类仍将可见。 |
prices.json
每个商店条目将物品 ID 映射到其分类、交易堆叠大小、买入价格和卖出价格。价格为 0 表示该方向被禁用。
"minecraft:diamond": {
"category": "gems",
"stack": 64,
"unit_buy": 100.0,
"unit_sell": 50.0
}
| 字段 |
说明 |
category |
分类键。必须存在于 categories 下;未知或空值将回退到“所有物品”类别。 |
stack |
在 GUI 中 Shift+点击购买时的批量数量。 |
unit_buy |
从服务器商店购买一个的价格。0 表示不可购买。购买时会在此基础上额外添加税费。 |
unit_sell |
服务器商店收购一个物品的价格。0 表示不可出售。会计入每日出售上限。 |
commands |
可选的控制台命令列表,在购买该条目时执行。其中的 {player} 会被替换为购买者的名字。 |
give_item |
可选。设置为 false 可使购买操作仅执行 commands 而不给予实体物品。默认为 true。 |
分类通过键映射到显示名称和显示物品:
"rewards": {
"name": "Server Rewards",
"display_item": "minecraft:nether_star"
}
命令奖励(领取方块、排名、工具包)
"minecraft:nether_star": {
"category": "rewards",
"stack": 1,
"unit_buy": 5000,
"unit_sell": 0,
"give_item": false,
"commands": ["claimblocks {player} add 1000"]
}
"minecraft:enchanted_golden_apple": {
"category": "rewards",
"stack": 1,
"unit_buy": 10000,
"unit_sell": 0,
"give_item": false,
"commands": ["lp user {player} parent add vip"]
}
命令以控制台权限运行,拥有完全权限,购买者会看到一条 “Rewards applied!” 消息。奖励条目在商店中会显示一行 “Grants perks on purchase” 的 Lore 描述。支持通过 GUI 和 /buy 命令使用。
箱子商店
由玩家运营的商店,用于用物品交换余额货币。无需书写告示牌:你只需搭建箱子和告示牌,然后通过命令将它们关联起来。
逐步设置
- 放置一个箱子(单个或双格),并在其正上方或侧面附加一个墙壁告示牌。站立式告示牌无效。
- 向箱子中放入至少一件你想要交易的物品。已售出的物品会自动检测,取自信箱中第一个非空的格子。
- 看着告示牌(在 5 格范围内)并运行
/shop create buy <price> 来向顾客出售商品,或者运行 /shop create sell <price> 来从顾客处购买商品。
- 告示牌会自动重写,商店随即开业。随着商品售出,请及时补充库存。
/shop 命令
| 命令 |
参数 |
描述 |
/shop create buy <price> |
price:最低 0.01,按单个物品计算 |
看向储物箱上的墙壁告示牌以开设售卖商店。顾客每次点击购买 1 个物品,价格为 price。 |
/shop create sell <price> |
price:最低 0.01,按单个物品计算 |
看向储物箱上的墙壁告示牌以开设收购商店。顾客每次点击出售 1 个物品给你,并从你的余额中获得 price。 |
/shop remove |
无(需看向告示牌) |
删除你锁定的商店。仅所有者可使用。 |
/shop info |
无(需看向告示牌) |
显示锁定商店的所有者、类型、价格和物品 ID。 |
/shop list |
无 |
列出你的所有商店,包括类型、物品和价格。 |
/shop admin <player> remove |
player:任何在线玩家;需看向告示牌 |
仅限操作员(权限等级 2 或更高)。无视所有者,直接删除锁定告示牌对应的商店。 |
创建和移除自己的商店无需特殊权限。一个告示牌和一个储物箱各自只能属于一个商店,且空储物箱无法成为商店。
告示牌布局(自动生成)
| 行 |
内容 |
描述 |
| 1 |
[BUY] 或 [SELL] |
商店类型,由创建命令设置。 |
| 2 |
物品名称 |
交易物品的显示名称,从储物箱中检测得出。 |
| 3 |
$<price> |
单个物品的价格。 |
| 4 |
所有者名称 |
商店所有者的名称,截断至 14 个字符。 |
交易机制
- 售卖商店(BUY shop):顾客必须拥有足够的余额,随后储物箱库存减少 1 个物品,顾客获得 1 个物品,价格从顾客转移至所有者(即使所有者离线也会记账),并更新告示牌侧的显示。
- 收购商店(SELL shop):顾客必须携带待交易的物品,储物箱必须有空闲槽位,且所有者必须能够支付该价格。随后 1 个物品从顾客转移至储物箱,价格从所有者转移至顾客。
- 每次点击恰好交易 1 个物品。储物箱交易无销售税,也无每日出售限制。
- 仅所有者和服务器操作员可以打开商店储物箱。其他玩家尝试时会因被阻止而收到提示信息。
- 商店数据存储在
config/viper-economy/shops.json 中,重启后不会丢失。
安装
- 为你的 Minecraft 版本安装 Fabric 加载器(1.21.x 使用 0.14.21 或更高版本,26.x 使用 0.19.3 或更高版本)以及 Fabric API。1.21.x 请使用 Java 21,26.x 请使用 Java 25。
- 下载与你的 Minecraft 版本(1.21.x、26.1、26.2 或 26.3)匹配的文件。
- 将 jar 文件放入服务器的
mods 文件夹中,并启动服务器一次。这将生成 config/viper-economy/config.json 和 prices.json。
- 根据需要编辑价格。大多数更改无需重启即可生效。
注意事项
- 存储使用的是服务器配置文件夹下的普通 JSON 文件。无需数据库。
- 1.21.x 构建版支持从 1.21 到 1.21.11 的版本。
- 需要 Fabric API(适用于你的 Minecraft 版本的任意版本)。
Viper Economy
Viper Economy is a server-side Fabric economy mod for Minecraft 1.21.x, 26.1.x, 26.2.x and 26.3.x. It adds virtual or physical currency, a server shop GUI, player chest shops, player-to-player payments and purchasable command rewards (claim blocks, ranks, kits). No client mod is needed: vanilla clients can join and use everything, and the mod also works in singleplayer.
Features
- Virtual currency (number balances stored per player) or physical currency (an item such as diamonds used as money).
- Server shop GUI with categories, pagination, per-item buy/sell prices, shift-click bulk buy/sell and a configurable purchase tax.
- Player chest shops: attach a sign to a chest to sell its contents, with ownership protection so other players cannot open shop chests.
- Player-to-player payments, balance leaderboard and held-item price checks.
- Command rewards: any shop entry can run console commands on purchase, for example giving claim blocks or a LuckPerms rank, with or without handing over a physical item.
- New accounts automatically receive the configured starting balance. Balances are saved to disk on every change and on server shutdown.
- A daily cap on how much each player can earn from selling, to slow inflation.
Commands
Player commands
| Command |
Permission node |
Description |
/bal [player] |
viper-economy.command.bal (viper-economy.command.bal.others to check others) |
Show your balance, or another online player's balance |
/pay <player> <amount> |
viper-economy.command.pay |
Send money from your balance to another player |
/baltop |
viper-economy.command.baltop |
Show the top 10 balances |
/withdraw <amount> |
viper-economy.command.withdraw |
Convert balance into physical currency items (physical mode only) |
/topup <amount> |
viper-economy.command.baltop |
Convert physical currency items from your inventory into balance (physical mode only) |
/worth |
viper-economy.command.worth |
Show the shop buy and sell price of the item in your main hand |
/buy <item> [amount] |
viper-economy.command.buy |
Buy an item from the server shop by id, for example /buy minecraft:diamond 5 |
/sell <item> [amount] |
viper-economy.command.sell |
Sell an item to the server shop by id |
/sell hand [amount] |
viper-economy.command.sell |
Sell the stack in your main hand, optionally capped to an amount |
/sell all [amount] |
viper-economy.command.sell |
Sell every matching item of the held type in your inventory |
/servershop |
viper-economy.command.servershop |
Open the server shop GUI |
Players can also use the shop GUI directly: left-click buys 1, shift-left-click buys a stack, right-click sells 1, shift-right-click sells everything of that item.
Admin commands (server operators only)
| Command |
Description |
/givemoney <player> <amount> |
Add money to a player's balance |
/takemoney <player> <amount> |
Remove money from a player's balance (fails if they cannot cover it) |
/setmoney <player> <amount> |
Set a player's balance to an exact value |
/resetmoney <player> |
Reset a player's balance to the configured starting balance |
/ecolog |
Show the active economy settings and the number of stored accounts |
Configuration
All files live in config/viper-economy/ on the server. config.json is created with defaults on first start. prices.json (500+ entries) is auto-deployed on first start; every registered item appears in the shop, with unpriced items listed as catalog-only until you set prices.
config.json
| Field |
Default |
Description |
economyMode |
"VIRTUAL" |
"VIRTUAL" stores balances as numbers. "PHYSICAL" counts currency items in inventories instead. |
physicalCurrencyItem |
"minecraft:diamond" |
Item id used as money when economyMode is "PHYSICAL". |
startingBalance |
1000.0 |
Balance granted to new accounts on first join. Also used by /resetmoney. |
dailyAmount |
100.0 |
Reserved. Currently only displayed by /ecolog and not granted automatically. |
dailySellLimit |
10000.0 |
Maximum total sell value each player can earn per day. Applies to the shop GUI and /sell. |
taxRate |
0.1 |
Fraction added on top of every server shop purchase (0.1 = 10 percent). |
pvpBalanceLossPercentage |
0.0 |
Reserved. Currently has no effect. |
standaloneCommands |
true |
Reserved. Currently has no effect; command access is controlled by the permission nodes above (all default to every player, level 0). |
standaloneAdminCommands |
false |
Reserved. Currently has no effect; admin commands always require operator status. |
scoreboardEnabled |
true |
Reserved. Currently has no effect; no scoreboard is rendered. |
serverShopEnabled |
true |
Set to false to disable /servershop and the shop GUI. |
showAllItemsCategory |
true |
Set to false to hide the All Items category from /servershop. Curated categories stay visible. |
prices.json
Each shop entry maps an item id to its category, transaction stack size, buy price and sell price. A price of 0 means that direction is disabled.
"minecraft:diamond": {
"category": "gems",
"stack": 64,
"unit_buy": 100.0,
"unit_sell": 50.0
}
| Field |
Description |
category |
Category key. Must exist under categories; unknown or blank values fall back to the All Items category. |
stack |
Bulk quantity for shift-click buying in the GUI. |
unit_buy |
Price to buy one from the server shop. 0 means not purchasable. Tax is added on top at purchase time. |
unit_sell |
Price the server shop pays for one. 0 means not sellable. Counts toward the daily sell limit. |
commands |
Optional list of console commands run when the entry is bought. {player} is replaced with the buyer's name. |
give_item |
Optional. Set to false so buying runs only the commands without giving a physical item. Defaults to true. |
Categories map a key to a display name and a display item:
"rewards": {
"name": "Server Rewards",
"display_item": "minecraft:nether_star"
}
Command rewards (claim blocks, ranks, kits)
"minecraft:nether_star": {
"category": "rewards",
"stack": 1,
"unit_buy": 5000,
"unit_sell": 0,
"give_item": false,
"commands": ["claimblocks {player} add 1000"]
}
"minecraft:enchanted_golden_apple": {
"category": "rewards",
"stack": 1,
"unit_buy": 10000,
"unit_sell": 0,
"give_item": false,
"commands": ["lp user {player} parent add vip"]
}
Commands run as console with full permissions, and the buyer sees a "Rewards applied!" message. Reward entries show a "Grants perks on purchase" lore line in the shop. Works from both the GUI and /buy.
Chest shops
Player-run shops that trade items for balance money. No sign writing is needed: you build the chest and sign, then link them with a command.
Setup, step by step
- Place a chest (single or double) and attach a wall sign directly to it. Standing signs do not work.
- Put at least one of the item you want to trade into the chest. The sold item is auto-detected from the first non-empty chest slot.
- Look at the sign (within 5 blocks) and run
/shop create buy <price> to sell to customers, or /shop create sell <price> to buy from customers.
- The sign is rewritten automatically and the shop opens for business. Restock the chest as it sells out.
The /shop commands
| Command |
Parameter |
Description |
/shop create buy <price> |
price: minimum 0.01, per single item |
Look at a wall sign on a stocked chest to open a selling shop. Customers buy 1 item per click for price. |
/shop create sell <price> |
price: minimum 0.01, per single item |
Look at a wall sign on a chest to open a buying shop. Customers sell you 1 item per click and receive price from your balance. |
/shop remove |
none (look at the sign) |
Delete your targeted shop. Only the owner can use it. |
/shop info |
none (look at the sign) |
Show owner, type, price and item id of the targeted shop. |
/shop list |
none |
List all of your shops with type, item and price. |
/shop admin <player> remove |
player: any online player; look at the sign |
Operator-only (permission level 2 or higher). Removes the targeted sign's shop regardless of owner. |
Creating and removing your own shops needs no special permission. One sign and one chest can each belong to only one shop, and an empty chest cannot become a shop.
Sign layout (written automatically)
| Line |
Content |
Description |
| 1 |
[BUY] or [SELL] |
Shop type, set by the create command. |
| 2 |
Item name |
Display name of the traded item, detected from the chest. |
| 3 |
$<price> |
Price per single item. |
| 4 |
Owner name |
Shop owner's name, truncated to 14 characters. |
How trading works
- BUY shop: the customer must have enough balance, then 1 item leaves the chest stock, 1 item is given to the customer, the price moves from the customer to the owner (credited even while the owner is offline), and the sign-side display updates.
- SELL shop: the customer must carry the traded item, the chest must have a free slot, and the owner must afford the price. Then 1 item moves from the customer into the chest and the price moves from the owner to the customer.
- Every click trades exactly 1 item. There is no sales tax and no daily sell limit on chest trades.
- Only the owner and server operators can open a shop chest. Other players are blocked with a message when they try.
- Shops are stored in
config/viper-economy/shops.json and survive restarts.
Installation
- Install Fabric Loader (0.14.21 or newer on 1.21.x, 0.19.3 or newer on 26.x) and Fabric API for your Minecraft version. Use Java 21 for 1.21.x and Java 25 for 26.x.
- Download the file below that matches your Minecraft version (1.21.x, 26.1, 26.2 or 26.3).
- Put the jar in the server
mods folder and start the server once. This generates config/viper-economy/config.json and prices.json.
- Edit the prices to taste. Most changes apply without a restart.
Notes
- Storage is plain JSON files under the server config folder. No database needed.
- The 1.21.x build runs on 1.21 through 1.21.11.
- Requires Fabric API (any version for your Minecraft release).
评论 0
登录后参与评分
还没有评论,来抢沙发吧