Bukkit Kotlin Script
Bukkript is a Bukkit plugin that allows server admins to customize their server easily with the power of Kotlin language and KotlinBukkitAPI.
- Implicit imports for KotlinBukkitAPI, Bukkit, Kotlin Coroutines
- Compilation cache
- Hot Recompilation
- Per script logging with per script log file.
- In game commands
- Additional dependencies by using
@file:Maven("DEPENDENCY")
and@file:MavenRepository("REPOSITORY URL")
- IntelliJ Support with KotlinBukkitAPI Tooling
More about the usage at the Documentation.
- Download Bukkript and KotlinBukkitAPI
- Put it in your server Plugin folder.
- Download the IntelliJ (recommendation is to download it by the app Jetbrains Toolbox)
- In IntelliJ, go to Setting->Plugins->Marketplace
- Download KotlinBukkitAPI Tooling
- Open your server folder
- Run the server to create the folder plugin/Bukkript/scripts or just create it in the IntelliJ
- In IntelliJ right click in the
scripts
folder and New->Bukkript Script - Develop it \o/
Creating a new command that sends Hello Script World!
test.bk.kts
command("scripttest") {
executor {
sender.msg("Hello Script World!")
}
}
Script with the usage of Jetbrains Exposed
with-dependency.bk.kts
@file:Maven("org.jetbrains.exposed:exposed-core:0.24.1")
@file:Maven("org.jetbrains.exposed:exposed-dao:0.24.1")
@file:Maven("org.jetbrains.exposed:exposed-jdbc:0.24.1")
@file:Maven("org.jetbrains.exposed:exposed-java-time:0.24.1")
val sqlConfig = DatabaseTypeConfig(
database = "test-server",
hostname = "localhost",
user = "root",
password = "12345",
port = 3306,
type = "h2"
)
object MarketTable : IntIdTable("bk-market") {
val seller = offlinePlayer("seller")
val item = text("item")
val price = double("price")
val postDate = datetime("post_date")
val isSold = bool("is_sold").default(false)
val costumer = offlinePlayer("costumer").nullable()
val soldTime = datetime("sold_time").nullable()
}
val dataSource = databaseTypeFrom(plugin.dataFolder, sqlConfig).dataSource()
val database = Database.connect(dataSource)
transaction(database) {
SchemaUtils.create(MarketTable)
}
- Kotlin by Jetbrains
- Shadow plugin by johnrengelman
- Plugin Dependency Manager by knightzmc