add item commands

This commit is contained in:
2026-04-01 18:18:05 +08:00
commit c9ae8e02e1
246 changed files with 51813 additions and 0 deletions

61
shop-commands-example.yml Normal file
View File

@@ -0,0 +1,61 @@
### 商店命令配置示例 ###
### 支持在reward中添加commands字段玩家购买时将执行命令而不是获得物品 ###
### 命令中的%player%会被替换为玩家名称 ###
shop:
commands:
item: COMMAND
name: "Commands"
order: 90
permission: bw.base
lore:
- "Special commands"
offers:
- price:
- type: IRON_INGOT
amount: 20
reward:
- type: BLAZE_ROD
commands:
- 'gamemode %player% creative'
- 'give %player% diamond 5'
- 'say %player% purchased a command pack!'
- price:
- type: GOLD_INGOT
amount: 10
reward:
- type: DIAMOND
commands:
- 'effect %player% minecraft:speed 30 1'
regular_items:
item: IRON_SWORD
name: "Regular Items"
order: 100
permission: bw.base
lore:
- "Normal items without commands"
offers:
- price:
- type: IRON_INGOT
amount: 5
reward:
- type: IRON_SWORD
- type: IRON_INGOT
amount: 2
commands:
- 'say %player% bought iron ingots'
### 说明 ###
# 1. 在reward部分添加commands字段
# 2. commands是一个字符串列表每条命令都会被执行
# 3. 使用%player%占位符来自动替换为购买者名称
# 4. 如果reward包含commands玩家将不会收到该物品而是执行命令
# 5. 如果不包含commands字段则正常给予物品
### 你的示例配置 ###
# - reward:
# - type: BLAZE_ROD
# commands:
# - 'gamemode %player% 1'
# price:
# - type: IRON_INGOT
# amount: 20