33 lines
996 B
Kotlin
33 lines
996 B
Kotlin
package pw.hamzantal.shopreborn
|
|
|
|
import hazae41.minecraft.kutils.bukkit.command
|
|
import hazae41.minecraft.kutils.bukkit.info
|
|
import hazae41.minecraft.kutils.bukkit.listen
|
|
import hazae41.minecraft.kutils.get
|
|
import org.bukkit.entity.Player
|
|
import org.bukkit.plugin.java.JavaPlugin
|
|
|
|
class ShopReborn : JavaPlugin() {
|
|
|
|
override fun onEnable() {
|
|
saveDefaultConfig()
|
|
|
|
Configurations.dataFolder = dataFolder
|
|
Configurations.main =
|
|
MainConfig(dataFolder["config.yml"])
|
|
Configurations.main.addShops()
|
|
|
|
listen(callback = ::baseListener)
|
|
|
|
command("shop") { sender, args ->
|
|
if (sender !is Player) return@command
|
|
if (args.isEmpty()) {
|
|
sender.openInventory(Configurations.main.inventory)
|
|
return@command
|
|
}
|
|
|
|
val shop = Configurations.shops.firstOrNull { it.name == args.component1() } ?: return@command
|
|
sender.openInventory(shop.inventory)
|
|
}
|
|
}
|
|
} |