From 4832b4b18def002de1eb61f735520bf0f687fccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E7=99=BD?= <67080574+xbaimiao@users.noreply.github.com> Date: Sun, 11 Sep 2022 19:14:27 +0800 Subject: [PATCH] fix bugs --- .../kotlin/com/github/xbaimiao/shoppro/core/item/Item.kt | 5 ++--- src/main/resources/shops/limit-buy.yml | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) 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