diff --git a/build.gradle.kts b/build.gradle.kts index d80571bf..e0b7da19 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,23 +1,24 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile val githubRepo = "jakobkmar/KSpigot" group = "net.axay" -version = "1.20.3" +version = "1.20.4" description = "A Kotlin API for Minecraft plugins using the Spigot or Paper toolchain" plugins { - kotlin("jvm") version "1.9.21" - kotlin("plugin.serialization") version "1.9.21" + kotlin("jvm") version "1.9.24" + kotlin("plugin.serialization") version "1.9.24" `java-library` `maven-publish` signing - id("org.jetbrains.dokka") version "1.9.10" + id("org.jetbrains.dokka") version "1.9.20" - id("io.papermc.paperweight.userdev") version "1.5.11" + id("io.papermc.paperweight.userdev") version "1.7.1" } repositories { @@ -25,11 +26,11 @@ repositories { } dependencies { - paperweight.paperDevBundle("1.20.4-R0.1-SNAPSHOT") + paperweight.paperDevBundle("1.20.6-R0.1-SNAPSHOT") - api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2") - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3") - api("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.7.3") + api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3") + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1") + api("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.8.1") } tasks { @@ -39,11 +40,11 @@ tasks { withType { options.encoding = "UTF-8" - options.release.set(17) + options.release.set(21) } withType { - kotlinOptions.jvmTarget = "17" + compilerOptions.jvmTarget.set(JvmTarget.JVM_21) } dokkaHtml.configure { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a5952066..48c0a02c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/net/axay/kspigot/commands/internal/BrigardierSupport.kt b/src/main/kotlin/net/axay/kspigot/commands/internal/BrigardierSupport.kt index 161be300..630d60c4 100644 --- a/src/main/kotlin/net/axay/kspigot/commands/internal/BrigardierSupport.kt +++ b/src/main/kotlin/net/axay/kspigot/commands/internal/BrigardierSupport.kt @@ -33,8 +33,8 @@ object BrigardierSupport { } @Suppress("HasPlatformType") - fun resolveCommandManager() = (server as org.bukkit.craftbukkit.v1_20_R3.CraftServer) - .server.vanillaCommandDispatcher + fun resolveCommandManager() = (server as org.bukkit.craftbukkit.CraftServer) + .server.commands internal fun registerAll() { executedDefaultRegistration = true @@ -52,7 +52,7 @@ object BrigardierSupport { fun updateCommandTree() { onlinePlayers.forEach { // send the command tree - resolveCommandManager().sendCommands((it as org.bukkit.craftbukkit.v1_20_R3.entity.CraftPlayer).handle) + resolveCommandManager().sendCommands((it as org.bukkit.craftbukkit.entity.CraftPlayer).handle) } } } diff --git a/src/main/kotlin/net/axay/kspigot/data/NBTDataLoader.kt b/src/main/kotlin/net/axay/kspigot/data/NBTDataLoader.kt index b298690f..7a9ac2f4 100644 --- a/src/main/kotlin/net/axay/kspigot/data/NBTDataLoader.kt +++ b/src/main/kotlin/net/axay/kspigot/data/NBTDataLoader.kt @@ -3,9 +3,10 @@ package net.axay.kspigot.data import net.axay.kspigot.annotations.NMS_General +import net.minecraft.core.component.DataComponents import net.minecraft.nbt.CompoundTag -import org.bukkit.craftbukkit.v1_20_R3.entity.CraftEntity -import org.bukkit.craftbukkit.v1_20_R3.inventory.CraftItemStack +import org.bukkit.craftbukkit.entity.CraftEntity +import org.bukkit.craftbukkit.inventory.CraftItemStack import org.bukkit.entity.Entity import org.bukkit.inventory.ItemStack @@ -22,8 +23,4 @@ var Entity.nbtData: CompoundTag @NMS_General val ItemStack.nbtData: CompoundTag - get() { - CraftItemStack.asNMSCopy(this).let { - return if (it.hasTag()) (it.tag ?: CompoundTag()) else CompoundTag() - } - } + get() = (this as? CraftItemStack)?.handle?.get(DataComponents.CUSTOM_DATA)?.copyTag() ?: CompoundTag() diff --git a/src/main/kotlin/net/axay/kspigot/extensions/bukkit/EntityExtensions.kt b/src/main/kotlin/net/axay/kspigot/extensions/bukkit/EntityExtensions.kt index 3c087bee..667dade1 100644 --- a/src/main/kotlin/net/axay/kspigot/extensions/bukkit/EntityExtensions.kt +++ b/src/main/kotlin/net/axay/kspigot/extensions/bukkit/EntityExtensions.kt @@ -138,7 +138,7 @@ fun Player.showOnlinePlayers() { @Deprecated("This function is unstable and it cannot be guaranteed that it will work at any time in the future.") @NMS_General fun Location.spawnCleanEntity(entityType: EntityType): Entity? { - val craftWorld = world as? org.bukkit.craftbukkit.v1_20_R3.CraftWorld ?: return null + val craftWorld = world as? org.bukkit.craftbukkit.CraftWorld ?: return null return craftWorld.makeEntity(this, entityType.entityClass!!)?.let { craftWorld.handle.addFreshEntity(it) return@let it.bukkitEntity diff --git a/src/main/kotlin/net/axay/kspigot/extensions/events/InteractEventExtensions.kt b/src/main/kotlin/net/axay/kspigot/extensions/events/InteractEventExtensions.kt index 9d12c541..4e0ecd85 100644 --- a/src/main/kotlin/net/axay/kspigot/extensions/events/InteractEventExtensions.kt +++ b/src/main/kotlin/net/axay/kspigot/extensions/events/InteractEventExtensions.kt @@ -21,7 +21,7 @@ val PlayerInteractEntityEvent.interactItem: ItemStack? return when (this.hand) { EquipmentSlot.HAND -> p.inventory.itemInMainHand EquipmentSlot.OFF_HAND -> p.inventory.itemInOffHand - EquipmentSlot.CHEST, EquipmentSlot.FEET, EquipmentSlot.HEAD, EquipmentSlot.LEGS -> null + EquipmentSlot.CHEST, EquipmentSlot.FEET, EquipmentSlot.HEAD, EquipmentSlot.LEGS, EquipmentSlot.BODY -> null } } diff --git a/src/main/kotlin/net/axay/kspigot/structures/Structure.kt b/src/main/kotlin/net/axay/kspigot/structures/Structure.kt index 0f67ec5a..13e182ac 100644 --- a/src/main/kotlin/net/axay/kspigot/structures/Structure.kt +++ b/src/main/kotlin/net/axay/kspigot/structures/Structure.kt @@ -10,7 +10,7 @@ import org.bukkit.Location import org.bukkit.Material import org.bukkit.block.Block import org.bukkit.block.data.BlockData -import org.bukkit.craftbukkit.v1_20_R3.entity.CraftEntity +import org.bukkit.craftbukkit.entity.CraftEntity import org.bukkit.entity.Entity import org.bukkit.entity.EntityType