CobbleDollars Command Shops
CobbleDollars Command Shops 是 CobbleDollars 的插件。它添加了可通过名称打开、并在服务器端完全管理的命令驱动型商店。该模组专为希望在不将游戏控制权移交至客户端的情况下,更好地控制商店行为、库存管理、访问规则和交易日志记录的服务器而设计。
版本 1.1.0 需要 Minecraft 1.21.1、NeoForge 21.1.230 或更高版本,以及
CobbleDollars 2.0.0+Beta-6.1+1.21.1 或更高版本。请在服务器和管理员客户端安装相同版本的插件;其他玩家无需安装此可选客户端插件即可使用商店。
请参阅 1.1.0 更新日志以获取升级说明。
新增功能
- 多个自定义商店,包含分类和商品项
- 每个商品项支持自定义价格和数量
- 有限商品项的按玩家库存机制
- 无限或有限库存模式
- 支持按间隔或每日重置规则的自动补货
- 可选的大批量购买奖励
- 针对商店、分类和商品项的访问规则
- 支持玩家标签(tags)、进度(advancements)、维度、时间范围和记分板数值
- 所有商店共用一个全局银行,或每个商店使用独立的本地银行
- 通过
item、stack、tag、mod、match.include 和 match.exclude 实现精确的银行与商店匹配
- 精确的物品堆叠匹配,包括物品数据/组件
- 运行时启用/禁用商店的控制功能
- 完整的商店、银行、反馈和审计设置的管理员编辑器
- 带有自定义失败消息的有序商店/银行访问条件检查
- 可搜索的审计浏览器,提供统计信息、交易详情和手动更改历史记录
- 上下文相关的英文/法文帮助、点击音效和本地反馈音效预览
- 服务器端验证和持久化库存数据
服务器优先
本模组旨在成为服务器权威系统。
它不替代 CobbleDollars 本身,不替代 CobbleDollars NPC,也不将商店逻辑移至客户端。它仅接管通过此插件打开的商店会话。
如果在客户端安装了相同的 jar 文件,模组还可以提供可选的客户端 UI 增强功能。核心商店逻辑仍保留在服务器上。
命令
公共命令:
管理员命令(权限等级 2):
/cdshops admin(需要管理员客户端安装此插件)
/cdshops open <shop> <targets>
/cdshops reload
/cdshops where
管理员面板列出商店,提供运行时启用/禁用控制,并在Banks之后包含一个Stocks选项卡,用于检查、调整和补货玩家库存。可见性变更和库存操作在服务器上立即生效,独立于配置Save。可见性变更和手动库存管理只能通过 /cdshops admin 获得,这需要权限等级 2 以及管理员客户端上安装的插件。
配置更改在未点击Save之前保持在草稿状态,并经过服务器验证和冲突检测。延迟响应会保留较新的编辑和活动的文本输入。以前的 list、visibility、stock、restock 和 stats 命令已被面板取代。
配置
在首次启动服务器时,模组会在以下位置生成其配置文件:
config/cobbledollarscommandshops/
CONFIG_GUIDE.md
audit.json
feedback.json
global_bank.json
shops/
general_store/
shop.json
blacksmith/
shop.json
explorer/
shop.json
syntax_showcase/
shop.json
bank.json
交易审计日志写入到:
logs/cobbledollarscommandshops/audit.jsonl
/cdshops admin 中的Audit选项卡异步读取活动的 audit.jsonl 文件和旋转归档的 .jsonl.zip 文件。它提供摘要、可搜索和排序的商店/玩家/物品/商品项统计信息,以及按最新优先的交易日志。所有视图均支持时间段和记录标识符过滤器、分页、详情页、相关交易链接以及显式刷新。审计浏览器为只读模式,并保留配置草稿。以前的 /cdshops stats 命令已移除。默认情况下,管理员手动库存更改和配置编辑会被记录,并且可以在Settings / Audit下独立切换。它们的日志条目包括管理员、受影响的库存或配置值、先前/新状态和操作 ID。配置状态区分了已准备、已应用、失败或回滚的请求;禁用配置历史的操作会在生效前被记录。自动补货和访问拒绝被排除在外。
编写商店和银行的重要文件
如果您想了解如何编写 shop.json 或 bank.json,请从这些文件开始:
config/cobbledollarscommandshops/CONFIG_GUIDE.md
模组首次启动时生成的主要格式参考。
config/cobbledollarscommandshops/global_bank.json
用作所有商店后备方案的默认银行。
config/cobbledollarscommandshops/shops/syntax_showcase/shop.json
展示支持的匹配语法和条件的完整示例商店。
config/cobbledollarscommandshops/shops/syntax_showcase/bank.json
商店特定银行覆盖的示例。
商店特定的银行文件位于此处:
config/cobbledollarscommandshops/shops/<shop_id>/bank.json
如果不存在商店特定的 bank.json,模组将使用:
config/cobbledollarscommandshops/global_bank.json
支持与问题
如果发现错误,请在评论中报告或提交 issue。您也可以直接在 CurseForge/Modrinth 上联系我以提出更具体的问题!
如果您想使用或修改此代码,请先检查许可证。
测试环境:
- CobbleDollars-neoforge-2.0.0+Beta-6.1+1.21.1
- Cobblemon-neoforge-1.8.2+1.21.1
- CustomNPCs-Unofficial-NeoForge-1.21.1.20251230
- easy_npc-neoforge-1.21.1-7.15.0
- easy_npc_config_ui-neoforge-1.21.1-7.15.0
- easy_model_entities-neoforge-1.21.1-2.5.0
- Kotlin for Forge 5.12.0
CobbleDollars Command Shops
CobbleDollars Command Shops is an addon for CobbleDollars. It adds command-driven shops that can be opened by name and fully managed on the server. The mod is built for servers that want more control over shop behavior, stock handling, access rules, and transaction logging without moving gameplay authority to the client.
Version 1.1.0 requires Minecraft 1.21.1, NeoForge 21.1.230 or newer and CobbleDollars
2.0.0+Beta-6.1+1.21.1 or newer. Install the same addon version on the server and
administrator clients; other players can use shops without the optional client addon.
See the 1.1.0 changelog for upgrade notes.
What it adds
- multiple custom shops with categories and offers
- custom prices and custom item counts per offer
- per-player stock for limited offers
- unlimited or finite stock
- automatic restocks with interval or daily reset rules
- optional purchase bonuses for bulk buys
- access rules for shops, categories, and offers
- support for player tags, advancements, dimensions, time ranges, and scoreboard values
- one global bank for all shops or a local bank per shop
- precise bank and shop matching with
item, stack, tag, mod, match.include, and match.exclude
- exact stack matching, including item data/components
- shop enable/disable controls at runtime
- a complete administrator editor for shops, banks, feedback and audit settings
- ordered shop/bank access conditions with a custom message for each failed rule
- a searchable Audit browser with statistics, transaction details and manual change history
- contextual English/French help, click sounds and local feedback sound previews
- server-side validation and persistent stock data
Server-side first
This mod is designed to be server-authoritative.
It does not replace CobbleDollars itself, does not replace CobbleDollars NPCs, and does not move shop logic to the client. It only takes over shop sessions opened through this addon.
If the same jar is installed on the client, the mod can also provide optional client-side UI enhancements. The core shop logic still remains on the server.
Commands
Public commands:
Admin commands (permission level 2):
/cdshops admin (requires this addon on the administrator's client)
/cdshops open <shop> <targets>
/cdshops reload
/cdshops where
The administrator panel lists shops, provides runtime enable/disable controls,
and includes a Stocks tab after Banks for inspecting,
adjusting, and restocking player stock. Visibility and stock actions apply
immediately on the server, independently of configuration Save.
Visibility changes and manual stock management are available exclusively through
/cdshops admin, requiring permission level 2 and the addon on the administrator's client.
Configuration changes stay in a draft until Save, with server validation and
conflict detection. Late responses preserve newer edits and active text entry. The former list, visibility,
stock, restock and stats commands have been replaced by the panel.
Configuration
On first server start, the mod generates its config files in:
config/cobbledollarscommandshops/
CONFIG_GUIDE.md
audit.json
feedback.json
global_bank.json
shops/
general_store/
shop.json
blacksmith/
shop.json
explorer/
shop.json
syntax_showcase/
shop.json
bank.json
Transaction audit logs are written to:
logs/cobbledollarscommandshops/audit.jsonl
The Audit tab in /cdshops admin reads the active audit.jsonl file and rotated .jsonl.zip archives asynchronously. It provides a summary, searchable and sortable shop/player/item/offer statistics, and a newest-first transaction journal. All views support period and recorded-identifier filters, pagination, detail pages, links to related transactions, and explicit refresh. The audit browser is read-only and preserves configuration drafts. The former /cdshops stats commands have been removed. Manual administrator stock changes and configuration edits are recorded by default and can be toggled independently under Settings / Audit. Their journal entries include the administrator, affected stock or configuration value, previous/new state and an operation ID. Configuration status distinguishes prepared requests from applied, failed or rolled back changes; disabling configuration history is recorded before it takes effect. Automatic refills and access denials are excluded.
Important files for writing shops and banks
If you want to understand how to write a shop.json or bank.json, start with these files:
config/cobbledollarscommandshops/CONFIG_GUIDE.md
Main format reference generated by the mod on first start.
config/cobbledollarscommandshops/global_bank.json
Default bank used as the fallback for all shops.
config/cobbledollarscommandshops/shops/syntax_showcase/shop.json
Full example shop showing the supported matching syntax and conditions.
config/cobbledollarscommandshops/shops/syntax_showcase/bank.json
Example of a shop-specific bank override.
Shop-specific bank files go here:
config/cobbledollarscommandshops/shops/<shop_id>/bank.json
If no shop-specific bank.json exists, the mod uses:
config/cobbledollarscommandshops/global_bank.json
Support and questions
If you find a bug, please report it in the comments or open an issue. You can also contact me directly on CurseForge/Modrinth for more specific questions !
If you want to use or modify this code, please check the license first.
tested with :
- CobbleDollars-neoforge-2.0.0+Beta-6.1+1.21.1
- Cobblemon-neoforge-1.8.2+1.21.1
- CustomNPCs-Unofficial-NeoForge-1.21.1.20251230
- easy_npc-neoforge-1.21.1-7.15.0
- easy_npc_config_ui-neoforge-1.21.1-7.15.0
- easy_model_entities-neoforge-1.21.1-2.5.0
- Kotlin for Forge 5.12.0
评论 0
登录后参与评分
还没有评论,来抢沙发吧