fix bugs
This commit is contained in:
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
group=com.github.xbaimiao.shoppro
|
group=com.github.xbaimiao.shoppro
|
||||||
version=1.0.3
|
version=1.0.4
|
||||||
@@ -28,25 +28,27 @@ 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) {
|
||||||
commands.map { it.replace("%player%", player.name) }.forEach { command ->
|
for (a in 1..amount){
|
||||||
if (command.startsWith("[tell] ")) {
|
commands.map { it.replace("%player%", player.name) }.forEach { command ->
|
||||||
player.sendMessage(command.substring(7).colored())
|
if (command.startsWith("[tell] ")) {
|
||||||
} else if (command.startsWith("[console] ")) {
|
player.sendMessage(command.substring(7).colored())
|
||||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.substring(10))
|
} else if (command.startsWith("[console] ")) {
|
||||||
} else if (command.startsWith("[player] ")) {
|
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.substring(10))
|
||||||
Bukkit.dispatchCommand(player, command.substring(9))
|
} else if (command.startsWith("[player] ")) {
|
||||||
} else if (command.startsWith("[open] ")) {
|
Bukkit.dispatchCommand(player, command.substring(9))
|
||||||
val shop = ShopManager.shops.firstOrNull { it.getName() == command.substring(7) }
|
} else if (command.startsWith("[open] ")) {
|
||||||
shop?.open(player)
|
val shop = ShopManager.shops.firstOrNull { it.getName() == command.substring(7) }
|
||||||
} else if (command.startsWith("[op] ")) {
|
shop?.open(player)
|
||||||
Bukkit.dispatchCommand(object : Player by player {
|
} else if (command.startsWith("[op] ")) {
|
||||||
override fun isOp() = true
|
Bukkit.dispatchCommand(object : Player by player {
|
||||||
override fun hasPermission(p0: Permission) = true
|
override fun isOp() = true
|
||||||
override fun hasPermission(p0: String) = true
|
override fun hasPermission(p0: Permission) = true
|
||||||
}, command.substring(5))
|
override fun hasPermission(p0: String) = true
|
||||||
} else if (command == "close" || command.startsWith("[close]")) {
|
}, command.substring(5))
|
||||||
player.closeInventory()
|
} else if (command == "close" || command.startsWith("[close]")) {
|
||||||
|
player.closeInventory()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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")
|
||||||
|
|||||||
Reference in New Issue
Block a user