Update to Minecraft 1.20.6 (#66)

* bump dependencies + updated to minecraft version 1.20.6 & java 21

* moved to stable kotlinx dependencies

* Change versions for 1.20.6 update

* Make 1.20.6 update compile

---------

Co-authored-by: Jakob K <dev@jakobk.de>
This commit is contained in:
Marlon
2024-05-31 18:19:02 +02:00
committed by GitHub
parent 441b94ca7c
commit 77e2e72f06
7 changed files with 23 additions and 25 deletions

View File

@@ -1,23 +1,24 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
val githubRepo = "jakobkmar/KSpigot" val githubRepo = "jakobkmar/KSpigot"
group = "net.axay" group = "net.axay"
version = "1.20.3" version = "1.20.4"
description = "A Kotlin API for Minecraft plugins using the Spigot or Paper toolchain" description = "A Kotlin API for Minecraft plugins using the Spigot or Paper toolchain"
plugins { plugins {
kotlin("jvm") version "1.9.21" kotlin("jvm") version "1.9.24"
kotlin("plugin.serialization") version "1.9.21" kotlin("plugin.serialization") version "1.9.24"
`java-library` `java-library`
`maven-publish` `maven-publish`
signing 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 { repositories {
@@ -25,11 +26,11 @@ repositories {
} }
dependencies { 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-serialization-json:1.6.3")
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3") api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1")
api("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.7.3") api("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.8.1")
} }
tasks { tasks {
@@ -39,11 +40,11 @@ tasks {
withType<JavaCompile> { withType<JavaCompile> {
options.encoding = "UTF-8" options.encoding = "UTF-8"
options.release.set(17) options.release.set(21)
} }
withType<KotlinCompile> { withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17" compilerOptions.jvmTarget.set(JvmTarget.JVM_21)
} }
dokkaHtml.configure { dokkaHtml.configure {

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-8.5-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@@ -33,8 +33,8 @@ object BrigardierSupport {
} }
@Suppress("HasPlatformType") @Suppress("HasPlatformType")
fun resolveCommandManager() = (server as org.bukkit.craftbukkit.v1_20_R3.CraftServer) fun resolveCommandManager() = (server as org.bukkit.craftbukkit.CraftServer)
.server.vanillaCommandDispatcher .server.commands
internal fun registerAll() { internal fun registerAll() {
executedDefaultRegistration = true executedDefaultRegistration = true
@@ -52,7 +52,7 @@ object BrigardierSupport {
fun updateCommandTree() { fun updateCommandTree() {
onlinePlayers.forEach { onlinePlayers.forEach {
// send the command tree // 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)
} }
} }
} }

View File

@@ -3,9 +3,10 @@
package net.axay.kspigot.data package net.axay.kspigot.data
import net.axay.kspigot.annotations.NMS_General import net.axay.kspigot.annotations.NMS_General
import net.minecraft.core.component.DataComponents
import net.minecraft.nbt.CompoundTag import net.minecraft.nbt.CompoundTag
import org.bukkit.craftbukkit.v1_20_R3.entity.CraftEntity import org.bukkit.craftbukkit.entity.CraftEntity
import org.bukkit.craftbukkit.v1_20_R3.inventory.CraftItemStack import org.bukkit.craftbukkit.inventory.CraftItemStack
import org.bukkit.entity.Entity import org.bukkit.entity.Entity
import org.bukkit.inventory.ItemStack import org.bukkit.inventory.ItemStack
@@ -22,8 +23,4 @@ var Entity.nbtData: CompoundTag
@NMS_General @NMS_General
val ItemStack.nbtData: CompoundTag val ItemStack.nbtData: CompoundTag
get() { get() = (this as? CraftItemStack)?.handle?.get(DataComponents.CUSTOM_DATA)?.copyTag() ?: CompoundTag()
CraftItemStack.asNMSCopy(this).let {
return if (it.hasTag()) (it.tag ?: CompoundTag()) else CompoundTag()
}
}

View File

@@ -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.") @Deprecated("This function is unstable and it cannot be guaranteed that it will work at any time in the future.")
@NMS_General @NMS_General
fun Location.spawnCleanEntity(entityType: EntityType): Entity? { 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 { return craftWorld.makeEntity(this, entityType.entityClass!!)?.let {
craftWorld.handle.addFreshEntity(it) craftWorld.handle.addFreshEntity(it)
return@let it.bukkitEntity return@let it.bukkitEntity

View File

@@ -21,7 +21,7 @@ val PlayerInteractEntityEvent.interactItem: ItemStack?
return when (this.hand) { return when (this.hand) {
EquipmentSlot.HAND -> p.inventory.itemInMainHand EquipmentSlot.HAND -> p.inventory.itemInMainHand
EquipmentSlot.OFF_HAND -> p.inventory.itemInOffHand 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
} }
} }

View File

@@ -10,7 +10,7 @@ import org.bukkit.Location
import org.bukkit.Material import org.bukkit.Material
import org.bukkit.block.Block import org.bukkit.block.Block
import org.bukkit.block.data.BlockData 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.Entity
import org.bukkit.entity.EntityType import org.bukkit.entity.EntityType