### 商店命令配置示例 ### ### 支持在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