Port to 1.20 with a paper plugin

master
kalle 2023-06-28 11:41:26 +02:00
parent 02a7f1659e
commit c4603bae60
5 changed files with 19 additions and 17 deletions

View File

@ -1,29 +1,30 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
kotlin("jvm") version "1.7.10" kotlin("jvm") version "1.8.22"
kotlin("plugin.serialization") version "1.7.0" kotlin("plugin.serialization") version "1.8.22"
id("maven-publish") id("maven-publish")
id("com.github.johnrengelman.shadow") version "7.1.2" id("com.github.johnrengelman.shadow") version "8.1.1"
id("io.papermc.paperweight.userdev") version "1.3.8" id("io.papermc.paperweight.userdev") version "1.5.5"
} }
group = "nl.kallestruik" group = "nl.kallestruik"
version = "1.5.0" version = "1.5.1"
repositories { repositories {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
paperDevBundle("1.19-R0.1-SNAPSHOT") paperweight.paperDevBundle("1.20-R0.1-SNAPSHOT")
implementation(kotlin("reflect")) implementation(kotlin("reflect"))
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3") implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.3") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1")
implementation("org.jetbrains.kotlin:kotlin-scripting-common") implementation("org.jetbrains.kotlin:kotlin-scripting-common")
implementation("org.jetbrains.kotlin:kotlin-scripting-jvm") implementation("org.jetbrains.kotlin:kotlin-scripting-jvm")
implementation("org.jetbrains.kotlin:kotlin-scripting-jvm-host") implementation("org.jetbrains.kotlin:kotlin-scripting-jvm-host")
implementation("net.kyori:adventure-text-serializer-plain:4.14.0")
testImplementation(kotlin("test-junit5")) testImplementation(kotlin("test-junit5"))
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2") testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
@ -87,4 +88,4 @@ kotlin {
languageSettings.optIn("kotlinx.serialization.ExperimentalSerializationApi") languageSettings.optIn("kotlinx.serialization.ExperimentalSerializationApi")
} }
} }
} }

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@ -1,10 +1,8 @@
package nl.kallestruik.dlib package nl.kallestruik.dlib
import net.kyori.adventure.text.Component
import nl.kallestruik.dlib.gui.chestGUI
import org.bukkit.plugin.java.JavaPlugin import org.bukkit.plugin.java.JavaPlugin
/** /**
* This class is only here to make sure that paper loads the plugin. * This class is only here to make sure that paper loads the plugin.
*/ */
class DLib: JavaPlugin() class DLib: JavaPlugin()

View File

@ -2,6 +2,7 @@ package nl.kallestruik.dlib.gui
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import net.kyori.adventure.text.Component import net.kyori.adventure.text.Component
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer
import org.bukkit.Material import org.bukkit.Material
import org.bukkit.entity.Player import org.bukkit.entity.Player
import org.bukkit.event.EventHandler import org.bukkit.event.EventHandler
@ -116,7 +117,9 @@ class TextInputDialog: Listener {
} }
val item = event.currentItem val item = event.currentItem
val name = item?.itemMeta?.displayName ?: "" val nameComponent = item?.itemMeta?.displayName() ?: Component.empty()
val name = PlainTextComponentSerializer.plainText().serialize(nameComponent)
if (name == "") { if (name == "") {
event.isCancelled = true event.isCancelled = true

View File

@ -1,4 +1,4 @@
name: "DLib" name: DLib
main: nl.kallestruik.dlib.DLib
version: ${version} version: ${version}
api-version: 1.16 main: nl.kallestruik.dlib.DLib
api-version: '1.20'