diff --git a/src/main/kotlin/com/github/xbaimiao/shoppro/core/item/Item.kt b/src/main/kotlin/com/github/xbaimiao/shoppro/core/item/Item.kt index a378ccb..d802f3f 100644 --- a/src/main/kotlin/com/github/xbaimiao/shoppro/core/item/Item.kt +++ b/src/main/kotlin/com/github/xbaimiao/shoppro/core/item/Item.kt @@ -29,8 +29,8 @@ interface Item { fun update(player: Player): ItemStack fun exeCommands(player: Player, amount: Int) { - for (a in 1..amount){ - commands.map { it.replace("%player%", player.name) }.forEach { command -> + commands.map { it.replace("%player%", player.name).replace("\${amount}", amount.toString()) } + .forEach { command -> if (command.startsWith("[tell] ")) { player.sendMessage(command.substring(7).colored()) } else if (command.startsWith("[console] ")) { @@ -50,7 +50,6 @@ interface Item { player.closeInventory() } } - } } } \ No newline at end of file diff --git a/src/main/resources/shops/limit-buy.yml b/src/main/resources/shops/limit-buy.yml index d641eed..0a05299 100644 --- a/src/main/resources/shops/limit-buy.yml +++ b/src/main/resources/shops/limit-buy.yml @@ -67,4 +67,4 @@ items: # 关闭此选项 可只执行命令 不给原版物品 vanilla: false commands: - - '[console] ia give %player% 物品' \ No newline at end of file + - '[console] ia give %player% 物品 ${amount}' \ No newline at end of file