This commit is contained in:
小白
2022-09-11 19:10:09 +08:00
parent a82dd19ff3
commit 9002093db4
3 changed files with 24 additions and 22 deletions
+1 -1
View File
@@ -1,2 +1,2 @@
group=com.github.xbaimiao.shoppro group=com.github.xbaimiao.shoppro
version=1.0.3 version=1.0.4
@@ -28,7 +28,8 @@ interface Item {
fun buildItem(): ItemStack fun buildItem(): ItemStack
fun update(player: Player): ItemStack fun update(player: Player): ItemStack
fun exeCommands(player: Player) { 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) }.forEach { command ->
if (command.startsWith("[tell] ")) { if (command.startsWith("[tell] ")) {
player.sendMessage(command.substring(7).colored()) player.sendMessage(command.substring(7).colored())
@@ -50,5 +51,6 @@ interface Item {
} }
} }
} }
}
} }
@@ -162,7 +162,7 @@ class ShopImpl(private val configuration: Configuration) : Shop() {
} }
} else { } else {
onClick(item.key) { onClick(item.key) {
item.exeCommands(player) item.exeCommands(player, 1)
} }
} }
} }
@@ -188,7 +188,7 @@ class ShopImpl(private val configuration: Configuration) : Shop() {
} }
Bukkit.getPluginManager().callEvent(ShopProBuyEvent(item, amount, player)) Bukkit.getPluginManager().callEvent(ShopProBuyEvent(item, amount, player))
ShopPro.database.addAmount(item, player, LimitData(amount.toLong(), 0L)) ShopPro.database.addAmount(item, player, LimitData(amount.toLong(), 0L))
item.exeCommands(player) item.exeCommands(player, amount)
player.sendLang("buy-item", amount, item.name, item.price * amount) player.sendLang("buy-item", amount, item.name, item.price * amount)
} else { } else {
player.sendLang("not-money") player.sendLang("not-money")