Skip to content

货币系统

AIOShop 支持多种货币类型,可以在同一商店中混合使用不同货币。

支持的货币类型

VAULT

标准的 Vault 经济系统货币,需要安装 Vault 和经济插件(如 EssentialsX)。

yaml
buy-price:
  amount: 100.0
  currency: "VAULT"

PLAYER_POINTS

PlayerPoints 插件的点券系统,需要安装 PlayerPoints 插件。

yaml
buy-price:
  amount: 50
  currency: "PLAYER_POINTS"

ITEM

使用物品作为货币,可以配置物品匹配条件。

yaml
buy-price:
  amount: 5
  currency: "ITEM"
  currency-item:
    material: "gold_ingot"
    display-name: "金锭"

PAPI

自定义 PlaceholderAPI 货币,需要在 papi-currencies.yml 中定义。

yaml
buy-price:
  amount: 100
  currency: "PAPI"
  currency-name: "vault_eco"  # 对应 papi-currencies.yml 中的定义

物品货币配置

物品货币支持多种匹配条件:

yaml
currency-item:
  # 基础匹配
  material: "gold_ingot"       # 物品类型
  display-name: "金锭"          # 显示名称(可选)

  # 高级匹配
  nameContains: "货币"          # 名称包含
  loreContains: "特殊物品"      # 描述包含

  # NBT 匹配
  nbt-contains:
    - key: "custom.currency"
      value: "true"

PAPI 货币配置

papi-currencies.yml 中定义自定义货币:

yaml
currencies:
  vault_eco:
    display-name: "&6&l金币"
    placeholder: "vault_eco_balance"      # 查询余额的占位符
    add-command: "eco give {player} {amount}"   # 增加余额命令
    take-command: "eco take {player} {amount}"  # 扣除余额命令
    description: "通过PAPI访问的Vault经济系统金币"

  custom_points:
    display-name: "&b&l积分"
    placeholder: "myplugin_points"
    add-command: "mypoints add {player} {amount}"
    take-command: "mypoints remove {player} {amount}"

出售奖励

出售物品时可以给予多种奖励:

货币奖励

yaml
sell-rewards:
  main:
    type: "CURRENCY"
    amount: 100.0
    currencyType: "VAULT"

物品奖励

yaml
sell-rewards:
  bonus:
    type: "ITEM"
    item: "diamond"
    amount: 1

经验奖励

yaml
sell-rewards:
  exp:
    type: "EXPERIENCE"
    amount: 50
    isLevel: false  # false=经验点, true=等级

命令奖励

yaml
sell-rewards:
  command:
    type: "COMMAND"
    commands:
      - "broadcast &e{player} &7出售了珍稀物品!"
      - "give {player} gold_ingot 5"

复合奖励示例

购买或出售时可以同时给予多种奖励:

yaml
items:
  gift_package:
    display-name: "&d&l复合奖励礼包"
    buy-price:
      amount: 500.0
      currency: "VAULT"
    buy-rewards:
      money_reward:
        type: "CURRENCY"
        amount: 200.0
        currencyType: "VAULT"
      item_reward:
        type: "ITEM"
        item: "diamond"
        amount: 5
      exp_reward:
        type: "EXPERIENCE"
        amount: 10
        isLevel: true
      command_reward:
        type: "COMMAND"
        commands:
          - "give {player} golden_apple 3"
          - "msg {player} &a恭喜获得复合奖励!"

折扣系统

可以为商品配置折扣:

yaml
items:
  discounted_item:
    display-name: "&a&lVIP专享商品"
    buy-price:
      amount: 1000.0
      currency: "VAULT"
    discount: 30  # 30% 折扣,实际价格为 700
    permission: "aioshop.vip"  # 只有 VIP 可以购买

默认货币

config.yml 中设置默认货币:

yaml
currency:
  default: "VAULT"

当商品未指定货币类型时,将使用默认货币。

基于 CC0 1.0 许可发布