WebshopLink
一款 Minecraft Forge 模组,允许玩家在游戏内的浏览器窗口中浏览并使用外部网络商店,随后将购买的商品直接应用到他们的物品栏中。
在本文档中,该项目始终被称为“模组”,即使讨论的是插件版本——其功能在任何情况下都相同。
WebshopLink 仅处理游戏内部分。 实际的商店(目录、定价、玩家获得什么物品)位于一个由你运行并遵循 WebshopLink HTTP 协议的外部 Web 服务中。请参阅 Wiki 了解协议规范,以及
demo/中的工作参考实现。
工作原理
- 玩家在在游戏中运行
/shop <type>。 - WebshopLink(服务器端)向你的商店 API 发送玩家当前的物品栏信息,并获取到一个会话 URL。
- 该 URL 在一个全屏的游戏内浏览器中打开(使用 MCEF 渲染),悬浮于游戏世界之上,底部带有一个小型按钮栏。
- 玩家在网页上构建购物车,然后点击 Finish Trade。
- WebshopLink 从你的 API 获取结果物品栏,验证玩家的物品栏自会话开始以来未发生变化,然后应用更改。关闭窗口(或点击 Cancel / ESC)将取消会话。
Player ──/shop──▶ WebshopLink (server) ──HTTP──▶ Your shop API
│ │
└──── opens in-game browser ───┘
│
Finish Trade ▼
inventory applied to player
特性
- 游戏内购物 — 网络商店渲染在游戏上方的 Chromium 浏览器中;无需切换到外部浏览器。
- 物品栏验证 — 如果玩家的物品栏在会话开始和确认之间发生了变化,购买将被拒绝,从而防止复制/竞争漏洞利用。
- 两步验证会话代码 — 每次调用都与你的 API 交换一个防篡改代码,以防止从外部伪造会话。
- API 密钥支持 — 发送到你的商店 API 的每个请求都携带一个可配置的
X-Webshop-Api-Key标头。 - 主物品栏 + 末影箱 支持,具有用于复杂物品的完整 NBT 序列化。
- 余额叠加层(可选) — 屏幕配置角落中的一个小型 HUD 框会渲染你的商店余额页面,以便玩家随时查看自己的余额。默认开启;位置、大小和 URL 均为客户端配置。参见 Balance overlay。
- 可选的网络连接 — 模组将其网络通道注册为可选,因此原版客户端(或没有模组的客户端)仍然可以连接到服务器;他们只是无法打开浏览器。
要求
| 端 | 必需 |
|---|---|
| 服务器 | WebshopLink 模组 |
| 客户端 | WebshopLink 模组 + MCEF |
| 其他 | 实现了 WebshopLink API 的外部网络商店 |
- Minecraft 1.20.1, Forge 47.x
- MCEF 2.2.0+(仅限客户端——专用服务器从不加载它)
缺少模组/MCEF 的玩家在运行 /shop 时会被提示安装它们。
命令
| 命令 | 描述 |
|---|---|
/shop <type> [label] |
取消任何未完成的会话,然后启动一个新的给定 type 的商店会话(发送给您的 API 的 shopSlug)。可选的 label 显示在确认 UI 中。打开游戏内浏览器。 |
/shopFinish <uuid> |
结账的手动后备方案(浏览器的 Finish Trade 按钮会自动执行此操作)。获取新物品栏并在聊天中提供可点击的确认链接。 |
/confirmFinish <uuid> |
应用已结账的物品栏更改。 |
/shopCancel <uuid> |
在本地和你的 API 中取消会话。 |
正常游戏只需要 /shop —— 浏览器的按钮驱动其余部分。其他命令作为后备方案存在,并为没有游戏内浏览器的客户端使用。
默认情况下任何人都可以运行 /shop。要将其限制为操作员/命令方块(以便商店仅在特定位置打开),请在配置中设置 shopCommandPermissionLevel —— 参见 Locking down /shop。
安装
服务器
- 下载最新的 WebshopLink 发布 JAR 文件。
- 将其放入服务器的
mods/文件夹中。 - 启动服务器一次以生成
config/webshoplink-common.toml,然后将其指向你的商店 API(参见 Wiki)。 - 重新启动。
客户端(每位玩家)
- 安装 MCEF。
- 安装 WebshopLink 模组。
文档
- Wiki — 服务器操作员设置:完整的配置参考、你的商店必须实现的 HTTP API、物品栏数据格式和安全模型。
demo/— 一个小的、完全注释的参考商店(Bun + Tailwind),你可以在本地运行它以试用模组或学习协议。
许可证
参见 LICENSE。
WebshopLink
A Minecraft Forge mod that lets players browse and use an external web shop inside an in-game browser window, then have the purchased items applied straight to their inventory.
Throughout the docs this project is referred to as a "mod", even where a plugin version is discussed — the functionality is the same regardless.
WebshopLink only handles the in-game side. The actual shop (catalog, pricing, what items a player gets) lives in an external web service that you run and that speaks WebshopLink's HTTP protocol. See the Wiki for the contract, and
demo/for a working reference implementation.
How it works
- A player runs
/shop <type>in game. - WebshopLink (server side) sends the player's current inventory to your shop API and gets back a session URL.
- The URL opens in a full-screen in-game browser (rendered with MCEF) floating over the game world, with a small button bar at the bottom.
- The player builds their cart on the web page, then clicks Finish Trade.
- WebshopLink fetches the resulting inventory from your API, verifies the player's inventory hasn't changed since the session started, and applies it. Closing the window (or Cancel / ESC) cancels the session.
Player ──/shop──▶ WebshopLink (server) ──HTTP──▶ Your shop API
│ │
└──── opens in-game browser ───┘
│
Finish Trade ▼
inventory applied to player
Features
- In-game shopping — the web shop renders in a Chromium browser overlaid on the game; no alt-tabbing to an external browser.
- Inventory verification — purchases are rejected if the player's inventory changed between starting the session and confirming, preventing duping/race exploits.
- Two-factor session code — an anti-tampering code is exchanged with your API on every call so sessions can't be forged from outside.
- API key support — every request to your shop API carries a configurable
X-Webshop-Api-Keyheader. - Main inventory + Ender Chest support, with full NBT serialization for complex items.
- Balance overlay (optional) — a small HUD box in a configurable screen corner renders your shop's balance page, so players always see their balance. On by default; position, size, and URL are client-side config. See Balance overlay.
- Optional networking — the mod registers its network channel as optional, so vanilla clients (or clients without the mod) can still connect to the server; they just can't open the browser.
Requirements
| Side | Required |
|---|---|
| Server | WebshopLink mod |
| Client | WebshopLink mod + MCEF |
| Elsewhere | An external web shop implementing the WebshopLink API |
- Minecraft 1.20.1, Forge 47.x
- MCEF 2.2.0+ (client only — the dedicated server never loads it)
Players whose client is missing the mod/MCEF will be told to install them when they run /shop.
Commands
| Command | Description |
|---|---|
/shop <type> [label] |
Cancels any unfinished session, then starts a new shop session of the given type (the shopSlug sent to your API). Optional label is shown in the confirmation UI. Opens the in-game browser. |
/shopFinish <uuid> |
Manual backstop for checkout (the browser's Finish Trade button does this automatically). Fetches the new inventory and offers a clickable confirm link in chat. |
/confirmFinish <uuid> |
Applies the checked-out inventory changes. |
/shopCancel <uuid> |
Cancels the session both locally and with your API. |
Normal play only needs /shop — the browser's buttons drive the rest. The other commands exist as fallbacks and for clients without the in-game browser.
By default anyone can run /shop. To restrict it to operators/command blocks (so shops only open at specific locations) set shopCommandPermissionLevel in the config — see Locking down /shop.
Installation
Server
- Download the latest WebshopLink release JAR.
- Drop it into the server's
mods/folder. - Start the server once to generate
config/webshoplink-common.toml, then point it at your shop API (see the Wiki). - Restart.
Client (each player)
- Install MCEF.
- Install the WebshopLink mod.
Documentation
- Wiki — server-operator setup: full config reference, the HTTP API your shop must implement, inventory data format, and the security model.
demo/— a small, fully-commented reference shop (Bun + Tailwind) you can run locally to try the mod or learn the contract.
License
See LICENSE.
下载 WebshopLink
下载 WebshopLink
下载 WebshopLink
下载 WebshopLink
下载 WebshopLink
下载 WebshopLink
下载 WebshopLink
下载 WebshopLink
下载 WebshopLink
下载 WebshopLink
暂无更新日志
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
更聪明地交易,随处存储,并用奇妙的原版增强机制打造更好的体验。
模组
沼泽村落与音乐蛙群!
模组
一个完整经济模组:玩家余额、动态定价商店、玩家市场、买入订单、货币物品以及网页仪表盘。
模组
一款包含传送点、家、套装、经济系统(/pay、/balance)、聊天格式化和 Moderation 功能(/mute、/ban、/kick)的服务器实用模组——无需任何插件。
模组
轻松为你的服务器或模组客户端添加必备功能。只选择你需要的!注重性能优化。
模组
增强并创建新的村庄和掠夺者前哨站,完美融入你的 Minecraft 世界。
评论 0
登录后参与评分
还没有评论,来抢沙发吧