Skip to content

Commit

Permalink
Update to Minecraft 1.20.6 (#66)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
DinoMarlir and jakobkmar authored May 31, 2024
1 parent 441b94c commit 77e2e72
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 25 deletions.
23 changes: 12 additions & 11 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
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 {
mavenCentral()
}

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 {
Expand All @@ -39,11 +40,11 @@ tasks {

withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(17)
options.release.set(21)
}

withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
compilerOptions.jvmTarget.set(JvmTarget.JVM_21)
}

dokkaHtml.configure {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
}
}
11 changes: 4 additions & 7 deletions src/main/kotlin/net/axay/kspigot/data/NBTDataLoader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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()
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/net/axay/kspigot/structures/Structure.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 77e2e72

Please sign in to comment.