MineCommerce

插件

· 作者 Bobcat

适用于 Minecraft 服务器的 WooCommerce 与 Shopify 集成

0 本站下载 0 关注 更新于 1 年前

最新 1.0-SNAPSHOT · 1.21.8 · Paper

一键开服(送7天)

MineCommerce

面向 Paper 1.21 的 Tebex 风格自托管商店插件 — 通过 WooCommerce 或 Shopify 商店以及 Stripe 支付,直接出售头衔、物品和礼包,无需高额手续费或第三方锁定。

MineCommerce 将你的商店与 Minecraft 服务器连接起来:

  • 玩家在商店(WooCommerce/Shopify + Stripe)购买。
  • Webhook 触发游戏内履约。
  • 交付物:物品、头衔(LuckPerms)、货币(Vault)或自定义命令。

功能

  • 支持 WooCommerce + Shopify
  • 数据库支持(默认 SQLite,可选 MySQL、Postgres)
  • 账号绑定(/minecommerce link <code>)
  • 订单履约(命令、物品、头衔、货币)
  • 退款与撤销,并附带审计日志
  • 重试队列,重启后持久化
  • 基岩版 UI 支持(通过 Floodgate + Geyser)
  • 商店 GUI,支持分类和产品图片
  • 定时同步 或 实时 Webhook
  • 可配置映射(mappings.yml)
  • JSON 日志 + REST API,便于监控
  • 安全的 Webhook 验证(HMAC)

安装

  1. 下载最新的 MineCommerce.jar。

  2. 放入服务器的 plugins/ 文件夹中。

  3. 重启服务器以生成配置文件:

    • config.yml
    • mappings.yml
    • minecommerce.db(如果使用 SQLite)

配置

config.yml

server:
  http_enabled: true
  http_port: 8443
  webhook_secret: "CHANGE_ME"
  store_url: "https://example.com/store"
  platform: woocommerce   # generic|woocommerce|shopify
  link_template: ""

delivery:
  retry_attempts: 5
  retry_backoff_seconds: 60

link:
  code_length: 6
  code_ttl_seconds: 900

security:
  verify_ssl: true
  max_webhook_age_seconds: 600

database:
  type: sqlite
  sqlite:
    path: minecommerce.db
  mysql:
    host: 127.0.0.1
    port: 3306
    user: minecommerce
    password: secret_password
    database: minecommerce
    ssl: true
  postgres:
    host: 127.0.0.1
    port: 5432
    user: minecommerce
    password: secret_password
    database: minecommerce
    ssl: true

woocommerce:
  base_url: "https://yourstore.example"
  consumer_key: "ck_..."
  consumer_secret: "cs_..."

shopify:
  shop: "your-shop"
  api_version: "2024-07"
  access_token: "shpat_..."

sync:
  enabled: true
  schedule_minutes: 60
  mode: write_mappings
  image_as_button: true

mappings.yml

将 WooCommerce/Shopify 中的 SKU 链接到游戏内操作。

products:
  vip_30d:
    name: "VIP Rank (30 days)"
    icon: "EMERALD"
    price: 9.99
    description: "30 days of VIP access"
    product_id: "123"       # WooCommerce product ID
    variant_id: "45678901"  # Shopify variant ID
    actions:
      - type: permission_group
        group: vip
        duration_days: 30
      - type: command
        command: "say {player} is now a VIP!"
      - type: currency
        amount: 1000

categories:
  featured:
    name: "Featured"
    icon: "GOLD_INGOT"
    description: "Top picks"
    skus:
      - vip_30d

支持的操作类型:command、permission_group、currency、item。 占位符:{player}、{uuid}、{order_id}、{sku}。


同步与 Webhook

手动同步

/minecommerce admin sync
  • 获取产品与分类
  • 重写 mappings.yml
  • 更新图片、SKU、变体

定时同步

通过以下配置设置:

sync:
  enabled: true
  schedule_minutes: 60

Webhook

  • 端点:POST http://<server>:<port>/api/v1/sync
  • 通过 X-Timestamp + X-Signature 进行安全验证(使用 webhook_secret 的 HMAC SHA256)

Shopify Delta

  • 端点:/api/v1/webhooks/shopify
  • 示例负载:
{ "id": 9876543210 }

WooCommerce Delta

  • 端点:/api/v1/webhooks/woocommerce
  • 示例负载:
{ "resource": "product", "id": 12345 }

命令

命令 权限 描述
/store minecommerce.store 打开游戏内商店 GUI / 发送商店链接
/minecommerce link <code> — 将玩家绑定到商店账号
/minecommerce status — 检查订单状态
/minecommerce admin sync minecommerce.admin 运行手动同步
/minecommerce admin deliver <id> minecommerce.admin 手动交付订单
/minecommerce admin revoke <id> minecommerce.admin 撤销订单
/minecommerce admin reload minecommerce.admin 重新加载配置

安全性

  • HMAC 签名的 Webhook 验证
  • 时间戳验证(max_webhook_age_seconds)
  • 幂等交付(防止重复)
  • 不存储银行卡数据(由 Stripe 处理)

示例流程

  1. 玩家在 WooCommerce/Shopify 上购买 VIP(30天)。

  2. 商店 → Stripe → 订单完成。

  3. Webhook → MineCommerce 插件。

  4. 插件查找 SKU → 执行映射的操作:

    • 添加 LuckPerms 组 vip(30天过期)。
    • 给予 1000 Vault 货币。
    • 运行自定义服务器命令。
  5. 记录交付;若失败则重试。


故障排除

  • 未找到产品: 检查 API 凭证和已发布的产品。
  • 图片未显示: 启用 image_as_button: true 并确认产品包含图片。
  • Webhook 401 错误: 重新检查签名生成和 Webhook 密钥。
  • SQLite 锁定: 在生产环境中迁移到 MySQL/Postgres。

路线图

  • SQLite 支持
  • MySQL/Postgres 支持
  • LuckPerms 与 Vault 集成
  • REST API(/api/v1/orders、/api/v1/refunds、/api/v1/health)
  • 退款/撤销

软依赖

  • LuckPerms — 头衔/权限
  • Vault — 经济集成
  • Floodgate + Geyser — 带图片的基岩版 UI

支持

  • 问题与功能请求:GitHub 跟踪器
  • 日志:plugins/MineCommerce/logs/
  • 配置文件:config.yml、mappings.yml(移除密钥)

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源