Savs Common Economy
一款功能全面的 服务端 Fabric 经济模组。它提供了一个稳健的经济系统,支持 JSON、SQLite、MySQL 和 PostgreSQL 存储,以及实体纸币、玩家箱子商店和跨服务器网络同步功能。
核心特性
- 数据库支持:从简单的 JSON(默认)开始,或者扩展到 SQLite、MySQL 或 PostgreSQL。
- Redis 网络同步:内置支持 Redis Pub/Sub。在代理设置和多服务器网络中同步余额和交易通知。
- Common Economy API:支持 Common Economy API,与 Universal Shops、Mob Money 和其他兼容的经济模组集成。
- 箱子商店:玩家商店。使用原版告示牌创建购买和出售的箱子商店。可以设置为拥有无限库存的管理员商店。
- 买卖系统:允许你的玩家直接使用
/buy 和 /sell 命令与服务器进行交易。(可通过 worth.json 自定义)。
- 纸币:玩家可以将其数字余额通过
/withdraw 提取为实体的原版纸张物品,用于交易或存放。
命令
玩家命令
/bal 或 /balance:查看自己的余额。
/bal <player>:查看其他玩家的余额。
/pay <player> <amount>:向其他玩家支付一定金额。
/baltop 或 /balancetop:查看服务器上最富有的玩家。
/withdraw <amount>:以实体纸币形式提取金钱。
/worth:查看手中物品的价值。
/worth all:查看背包中与手中物品匹配的所有物品的总价值。
/worth list:查看所有服务器买卖价格的分类彩色表格。
/worth <item>:查看特定物品的价值。
/buy <item> [amount]:直接从服务器购买商品。
/sell:出售手中当前的物品堆。
/sell all:出售背包中所有相同的物品。
商店命令
/shop create sell <price>:创建一个出售商店(将物品卖给玩家)。
/shop create buy <price>:创建一个购买商店(从玩家处购买物品)。
/shop remove:进入移除模式,点击告示牌以删除商店。
/shop info:显示你正在查看的商店的信息。
/shop list:列出你拥有的所有活跃商店。
管理员命令 (Level 2+ / 可配置)
/givemoney <player> <amount>:向玩家账户添加金钱。
/takemoney <player> <amount>:从玩家账户扣除金钱。
/setmoney <player> <amount>:将玩家余额设置为特定金额。
/resetmoney <player>:将玩家余额重置为默认起始值。
/shop admin:切换管理员商店创建(无限库存/资金)。
/ecolog <target> <time> <unit> [page]:搜索交易日志(例如 /ecolog * 1 h)。
配置指南
主配置文件会自动创建于 config/savs-common-economy/config.json。
从这里,你可以更改默认起始余额、货币符号和数据库详细信息。
{
"defaultBalance": 1000.0,
"currencySymbol": "$",
"symbolBeforeAmount": true,
"enableSellCommands": false,
"enableChestShops": true,
"storage": {
"type": "JSON",
"host": "localhost",
"port": 3306,
"database": "savs_economy",
"user": "root",
"password": "password",
"tablePrefix": "savs_eco_",
"poolSize": 10,
"connectionTimeout": 30000,
"idleTimeout": 600000
},
"redis": {
"enabled": false,
"host": "localhost",
"port": 6379,
"password": "",
"channel": "savs-economy-updates",
"debugLogging": false,
"timeout_ms": 5000,
"client_name": "Savs-Economy-Node"
},
"apiNotificationMode": "ACTION_BAR",
"commandNotificationMode": "CHAT"
}
配置设置说明
常规设置
defaultBalance:新玩家首次加入时获得的初始金钱数量。
currencySymbol:显示在金额旁边的符号(例如 "$"、"€"、"Coins")。
symbolBeforeAmount:如果为 true,输出显示 $100。如果为 false,输出显示 100$。
enableSellCommands:开启或关闭 /worth、/buy 和 /sell 服务器市场功能。
enableChestShops:开启或关闭玩家箱子商店告示牌系统。
存储选项
控制如何保存玩家余额。
storage.type:选择如何保存玩家余额。JSON 是默认选项,适合标准服务器。如果你运行大型网络,请将其更改为 MYSQL 或 POSTGRESQL。
storage.host / port / database / user / password:仅在使用 MYSQL 或 POSTGRESQL 时填写这些内容。
storage.tablePrefix:用于数据库表的前缀(默认为 savs_eco_)。
Redis 网络同步(可选)
如果你运行多服务器网络,请开启此功能以在不同服务器之间同步余额。
redis.enabled:将此设置为 true 以启用跨服务器的余额共享。
redis.host / port / password:你的 Redis 服务器登录详情(端口通常为 6379)。
redis.channel:确保你网络中的每个服务器在此处输入完全相同的文本,以便它们能够相互通信。
聊天通知
控制交易消息在玩家端的显示方式。
可设置为 ACTION_BAR(在快捷栏上方短暂显示)、CHAT(标准聊天消息)或 NONE。
apiNotificationMode:由其他插件自动触发的消息。
commandNotificationMode:来自玩家命令(如 /pay)的消息。
权限与 OP 等级
该模组支持 LuckPerms(推荐)和 Fabric Permissions API。
如果你没有使用权限管理器,我们将优雅地回退到标准的原版 OP 等级。打开 config/savs-common-economy/permissions.json 文件即可轻松更改每个命令所需的 OP 等级。大多数标准玩家命令默认为 OP 等级 0(所有人),而管理员命令默认为 OP 等级 2。
以下是你可以在配置文件中更改的所有当前权限节点列表:
玩家命令节点(默认:等级 0)
savscommoneconomy.command.bal: 允许使用 /bal 查看自己的余额。
savscommoneconomy.command.bal.others: 允许使用 /bal <player> 查看其他玩家的余额。
savscommoneconomy.command.pay: 允许使用 /pay。
savscommoneconomy.command.withdraw: 允许使用 /withdraw。
savscommoneconomy.command.baltop: 允许使用 /baltop。
savscommoneconomy.command.worth: 允许使用 /worth 和 /worth all。
savscommoneconomy.command.sell: 允许使用 /sell 和 /sell all。
savscommoneconomy.command.buy: 允许使用 /buy。
商店命令节点(默认:等级 0)
savscommoneconomy.shop.create: 允许创建购买和出售的箱子商店。
savscommoneconomy.shop.info: 允许查看商店详情。
savscommoneconomy.shop.list: 允许查看所有你活跃的商店。
savscommoneconomy.shop.remove: 允许安全地破坏你自己的商店。
管理员命令节点(默认:等级 2)
所有强大的管理功能都安全地集中在单个节点约束下。
savscommoneconomy.admin: 控制对所有管理功能的访问,包括 /givemoney、/takemoney、/setmoney、/resetmoney、/shop admin 和 /ecolog。
箱子商店设置
箱子商店允许玩家或管理员直接从箱子中买卖物品。
如何创建商店:
- 放置任意箱子容器并放入物品(如果是制作
sell 商店)。
- 手持你想要销售的精确匹配物品,正对着箱子查看。
- 运行
/shop create sell 100 创建一个以每次交互单位 $100 的价格向玩家出售物品的商店。
- 或者,运行
/shop create buy 50 创建一个以每次交互单位 $50 的价格从玩家处购买物品的商店。
如何与商店进行交易:
- 右键点击任何实体商店告示牌以开始交易。
- 在聊天中输入你想购买或出售的数量(例如输入
10 或输入 all),然后按回车键。
- 接收你的物品或金钱。
Savs Common Economy
A comprehensive server-side economy mod for Fabric. It provides a robust economy system with support for JSON, SQLite, MySQL, and PostgreSQL storage, physical bank notes, player chest shops, and cross-server network synchronization.
Core Features
- Database Support: Start simple with JSON (default), or scale up to SQLite, MySQL, or PostgreSQL.
- Redis Network Sync: Built-in support for Redis Pub/Sub. Synchronize balances and transaction notifications across proxy setups and multi-server networks.
- Common Economy API: Supports the Common Economy API, integrating with Universal Shops, Mob Money, and other compliant economy mods.
- Chest Shops: Player shops. Create buy and sell chest shops using vanilla signs. Can be made into Admin Shops with infinite stock.
- Buy & Sell System: Allow your players to directly trade with the server using
/buy and /sell commands. (Customizable via worth.json).
- Bank Notes: Players can
/withdraw their digital balance into physical vanilla paper items to trade or stash away.
Commands
Player Commands
/bal or /balance: Check your own balance.
/bal <player>: Check another player's balance.
/pay <player> <amount>: Pay an amount to another player.
/baltop or /balancetop: View the richest players on the server.
/withdraw <amount>: Withdraw money as a physical bank note.
/worth: Check the value of the item in your hand.
/worth all: Check the value of all items in your inventory matching the one in your hand.
/worth list: View an organized, colored table of all server buy and sell prices.
/worth <item>: Check the value of a specific item.
/buy <item> [amount]: Purchase items directly from the server.
/sell: Sell the item stack currently in your hand.
/sell all: Sell all identical items in your inventory.
Shop Commands
/shop create sell <price>: Create a selling shop (sells items TO players).
/shop create buy <price>: Create a buying shop (buys items FROM players).
/shop remove: Enter remove-mode to delete a shop by clicking on its sign.
/shop info: Display information about the shop you are looking at.
/shop list: List all active shops you own.
Admin Commands (Level 2+ / Configurable)
/givemoney <player> <amount>: Add money to a player's account.
/takemoney <player> <amount>: Remove money from a player's account.
/setmoney <player> <amount>: Set a player's balance to a specific amount.
/resetmoney <player>: Reset a player's balance to the default starting value.
/shop admin: Toggle Admin Shop creation (infinite stock/funds).
/ecolog <target> <time> <unit> [page]: Search transaction logs (e.g., /ecolog * 1 h).
Configuration Guide
The main configuration file is automatically created at config/savs-common-economy/config.json.
From here, you can change the default starting balances, currency symbols, and database details.
{
"defaultBalance": 1000.0,
"currencySymbol": "$",
"symbolBeforeAmount": true,
"enableSellCommands": false,
"enableChestShops": true,
"storage": {
"type": "JSON",
"host": "localhost",
"port": 3306,
"database": "savs_economy",
"user": "root",
"password": "password",
"tablePrefix": "savs_eco_",
"poolSize": 10,
"connectionTimeout": 30000,
"idleTimeout": 600000
},
"redis": {
"enabled": false,
"host": "localhost",
"port": 6379,
"password": "",
"channel": "savs-economy-updates",
"debugLogging": false,
"timeout_ms": 5000,
"client_name": "Savs-Economy-Node"
},
"apiNotificationMode": "ACTION_BAR",
"commandNotificationMode": "CHAT"
}
Config Settings Explained
General
defaultBalance: How much money new players start with when they first join.
currencySymbol: The symbol shown next to money amounts (e.g. "$", "€", "Coins").
symbolBeforeAmount: If true, output shows $100. If false, output shows 100$.
enableSellCommands: Turns the /worth, /buy, and /sell server market on or off.
enableChestShops: Turns the player chest shop sign system on or off.
Storage Options
Controls how player balances are saved.
storage.type: Choose how to save player balances. JSON is the default and is perfect for standard servers. Change this to MYSQL or POSTGRESQL if you run a large network.
storage.host / port / database / user / password: Fill these in only if you are using MYSQL or POSTGRESQL.
storage.tablePrefix: The prefix used for the database tables (default savs_eco_).
Redis Network Sync (Optional)
If you run a multi-server network, turn this on to sync balances between your servers.
redis.enabled: Turn this to true to enable sharing balances across servers.
redis.host / port / password: Your Redis server login details (Port is usually 6379).
redis.channel: Make sure every server in your network has the EXACT same text here so they can talk to each other.
Chat Notifications
Controls how transaction messages appear to players.
Set these to ACTION_BAR (shows briefly above the hotbar), CHAT (standard chat message), or NONE.
apiNotificationMode: Messages triggered automatically by other plugins.
commandNotificationMode: Messages from player commands like /pay.
Permissions & OP Levels
The mod supports LuckPerms (Recommended) and the Fabric Permissions API.
If you aren't using a permissions manager, we gracefully fall back to standard Vanilla OP Levels. Open the config/savs-common-economy/permissions.json file to easily change what OP level is required for each command. Most standard player commands default to OP level 0 (everyone), while admin commands default to OP level 2.
Here is a list of all current permission nodes you can change in the config:
Player Command Nodes (Default: Level 0)
savscommoneconomy.command.bal: Access to /bal for checking your own balance.
savscommoneconomy.command.bal.others: Access to /bal <player> for checking someone else's balance.
savscommoneconomy.command.pay: Access to /pay.
savscommoneconomy.command.withdraw: Access to /withdraw.
savscommoneconomy.command.baltop: Access to /baltop.
savscommoneconomy.command.worth: Access to /worth and /worth all.
savscommoneconomy.command.sell: Access to /sell and /sell all.
savscommoneconomy.command.buy: Access to /buy.
Shop Command Nodes (Default: Level 0)
savscommoneconomy.shop.create: Access to create both buy and sell chest shops.
savscommoneconomy.shop.info: Access to check shop details.
savscommoneconomy.shop.list: Access to see all your active shops.
savscommoneconomy.shop.remove: Access to safely break your own shops.
Admin Command Nodes (Default: Level 2)
All powerful administrative features are grouped securely under one single node constraint.
savscommoneconomy.admin: Controls access to all admin features including /givemoney, /takemoney, /setmoney, /resetmoney, /shop admin, and /ecolog.
Chest Shops Setup
Chest shops allow players or admins to buy and sell items directly from chests.
How to create a Shop:
- Place any chest container and insert items (if making a
sell shop).
- Look precisely at the chest while holding the precise matching item you wish to market.
- Run
/shop create sell 100 to create a shop that sells items to players for $100 per interaction unit.
- Or, run
/shop create buy 50 to create a shop that purchases items from players for $50 per interaction unit.
How to trade with a Shop:
- Right-click any physical shop sign to begin a transaction.
- Type in the chat the amount you want to buy or sell (e.g. type
10 or type all) and press enter.
- Receive your items or money.
评论 0
登录后参与评分
还没有评论,来抢沙发吧