Skip to content

Commit

Permalink
Updated to Kotlin version 1.8.20 and migrated to Kotlin DSL
Browse files Browse the repository at this point in the history
  • Loading branch information
felix0351z committed Oct 3, 2023
1 parent 7b9c88a commit 9a2b304
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 74 deletions.
69 changes: 0 additions & 69 deletions build.gradle

This file was deleted.

65 changes: 65 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.archivesName
import java.net.URI

plugins {
val kotlinPluginVersion = "1.8.20"
val shadowVersion = "7.0.0"

kotlin("jvm") version kotlinPluginVersion
id("com.github.johnrengelman.shadow") version shadowVersion
}

group = "de.felix0351"
version = "1.0"

repositories {
mavenCentral()
maven {
name = "spigotmc-repo"
url = URI("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
}
}

dependencies {
compileOnly("org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT")
val kotlin_version = "1.8.20"
val ktor_version = "2.3.4"
val exposed_version = "0.44.0"
val coroutines_version = "1.7.3"
val sqlite_version = "3.43.0.0"
val mariadb_version = "3.2.0"

//Kotlin standard library
implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version")
//Kotlin Exposed SQL library
implementation("org.jetbrains.exposed:exposed-core:$exposed_version")
implementation("org.jetbrains.exposed:exposed-dao:$exposed_version")
implementation("org.jetbrains.exposed:exposed-jdbc:$exposed_version")
//Kotlin Coroutines Core for JVM
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
//Kotlin Ktor library for network communication
implementation("io.ktor:ktor-client-core:$ktor_version")
implementation("io.ktor:ktor-client-cio:$ktor_version")
implementation("io.ktor:ktor-client-java:$ktor_version")
implementation("io.ktor:ktor-client-content-negotiation:$ktor_version")
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktor_version")

//SQLite Driver
implementation("org.xerial:sqlite-jdbc:$sqlite_version")
//MariaDB Driver
implementation("org.mariadb.jdbc:mariadb-java-client:$mariadb_version")

}

tasks.withType<PublishToMavenRepository> {
dependsOn(tasks.shadowJar)
}

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}

shadow {
archivesName.set("KotlinBukkitLib")
version = "1.8.20" // Set the version to the current kotlin version
}
1 change: 0 additions & 1 deletion settings.gradle

This file was deleted.

1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = "KotlinBukkitLib"
21 changes: 20 additions & 1 deletion src/main/java/de/felix0351/kotlinbukkitlib/KotlinBukkitLib.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
package de.felix0351.kotlinbukkitlib

import org.bukkit.ChatColor
import org.bukkit.command.Command
import org.bukkit.command.CommandExecutor
import org.bukkit.command.CommandSender
import org.bukkit.plugin.java.JavaPlugin

class KotlinBukkitLib : JavaPlugin()
class KotlinBukkitLib : JavaPlugin(), CommandExecutor {

override fun onEnable() {
getCommand("kotlinbukkitlib")?.setExecutor(this)
server.consoleSender.sendMessage(ChatColor.LIGHT_PURPLE.toString() + "Keep Calm and Love Kotlin!")
super.onEnable()
}


override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>?): Boolean {
sender.sendMessage("§dKeep Calm and Love Kotlin!")
return true
}


}
12 changes: 9 additions & 3 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
name: KotlinBukkitLib
version: '${version}'
version: 1.8.20
main: de.felix0351.kotlinbukkitlib.KotlinBukkitLib
api-version: 1.15
load: STARTUP
authors: [ felix0351 ]
description: KotlinBukkitLib is a Bukkit-Plugin which load the Kotlin libraries for your mod.
description: KotlinBukkitLib is a Bukkit-Plugin which loads the standard kotlin libraries for your plugins with ktor, kotlinx.coroutines, kotlinx.serialization as well as the sqlite and the mariadb driver.
website: https://github.com/felix0351z


commands:
kotlinbukkitlib:
description: Show your love for Kotlin!
usage: /kotlinbukkitlib

0 comments on commit 9a2b304

Please sign in to comment.