Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 1.20.5 support #68

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ subprojects {
maven("https://repo.mineinabyss.com/releases")
maven("https://erethon.de/repo/")
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
maven("https://repo.codemc.io/repository/maven-snapshots/")
maven("https://jitpack.io")
maven("https://mvn.lumine.io/repository/maven-public/") { metadataSources { artifact() } }// MythicMobs
Expand Down Expand Up @@ -50,6 +51,12 @@ tasks {
build {
dependsOn(gradle.includedBuilds.map { it.task(":build") })
}

withType<Jar> {
manifest {
attributes["paperweight-mappings-namespace"] = "mojang"
}
}
}

fun isNonStable(version: String): Boolean {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
group=com.mineinabyss
version=0.23
version=0.24
30 changes: 15 additions & 15 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[versions]
anvilgui = "1.9.2-SNAPSHOT"
anvilgui = "1.9.3-SNAPSHOT"
compose = "1.6.1"
coroutines = "1.8.0"
creative = "1.7.0"
creative = "1.7.2"
dependencyversions = "0.51.0"
dokka = "1.9.0"
exposed = "0.48.0"
fastutil = "8.2.2"
fawe = "2.8.4"
itemsadder = "3.6.1"
junit = "5.10.2"
jvm = "17"
kaml = "0.57.0"
jvm = "21"
kaml = "0.59.0"
kmongo = "4.11.0"
kotest = "5.8.1"
# @pin
Expand All @@ -21,19 +21,19 @@ ktor = "2.3.9"
logback = "1.5.3"
mccoroutine = "2.15.0"
# @pin
minecraft = "1.20.4-R0.1-SNAPSHOT"
mockbukkit = "3.78.0"
minecraft = "1.20.6-R0.1-SNAPSHOT"
mockbukkit = "3.86.0"
mockk = "1.13.10"
modelengine = "R4.0.4"
mythic-dist = "5.6.0"
mythiccrucible = "2.0.0-SNAPSHOT"
oraxen = "1.170.0"
protocollib = "5.1.0"
modelengine = "R4.0.6"
mythic-dist = "5.6.2"
mythiccrucible = "2.0.0"
oraxen = "1.173.0"
protocollib = "5.2.0-SNAPSHOT"
reflections = "0.10.2"
serialization = "1.6.3"
shadowjar = "8.1.1"
shadowjar = "8.1.7"
sqlite-jdbc = "3.45.2.0"
userdev = "1.5.11"
userdev = "1.7.0"
vault = "1.7"
version-catalog-update = "0.8.4"
worldguard = "7.1.0-SNAPSHOT"
Expand All @@ -50,7 +50,7 @@ fastutil = { module = "it.unimi.dsi:fastutil", version.ref = "fastutil" }
gradle-dokka = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" }
gradle-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
gradle-paperweight-userdev = { module = "io.papermc.paperweight:paperweight-userdev", version.ref = "userdev" }
gradle-shadowjar = { module = "com.github.johnrengelman:shadow", version.ref = "shadowjar" }
gradle-shadowjar = { module = "io.github.goooler.shadow:shadow-gradle-plugin", version.ref = "shadowjar" }
junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" }
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit" }
kermit = "co.touchlab:kermit:2.0.3"
Expand Down Expand Up @@ -156,5 +156,5 @@ dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
shadowjar = { id = "com.github.johnrengelman.shadow", version.ref = "shadowjar" }
shadowjar = { id = "io.github.goooler.shadow", version.ref = "shadowjar" }
version-catalog-update = { id = "nl.littlerobots.version-catalog-update", version.ref = "version-catalog-update" }
2 changes: 2 additions & 0 deletions idofront-catalog-shaded/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ plugins {
id("com.mineinabyss.conventions.nms")
}

paperweight.reobfArtifactConfiguration = io.papermc.paperweight.userdev.ReobfArtifactConfiguration.MOJANG_PRODUCTION

val libs = rootProject.extensions.getByType<VersionCatalogsExtension>().named("libs")

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Command(
if (sender is ConsoleCommandSender && subcommands.size > 1) topCommandInfo = "\n" + topCommandInfo

subCommandsInfo = subcommands.filter { permissionsMetFor(it, false) }.mapIndexed { i, it ->
var line = " <gold> ${if (i == subcommands.size - 1) "┗" else "┣"} <i>${it.names.first()}</i><gray> "
var line = " <gold> ${if (i == subcommands.size - 1) "┗" else "┣"} <i>${it.names.firstOrNull()}</i><gray> "
if (it.description.isNotEmpty()) line += "- ${it.description}"
line
}.joinToString(separator = "\n")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.mineinabyss.idofront.config

import com.charleskorn.kaml.SingleLineStringStyle
import com.charleskorn.kaml.Yaml
import com.charleskorn.kaml.YamlConfiguration
import com.charleskorn.kaml.*
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.SerializationStrategy
import kotlinx.serialization.StringFormat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import kotlin.jvm.optionals.getOrNull

plugins {
java
com.github.johnrengelman.shadow
io.github.goooler.shadow
}

val pluginPath = project.findProperty("plugin_path") as? String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,3 @@ val libs = idofrontLibsRef
dependencies {
paperweight.paperDevBundle(libs.findVersion("minecraft").get().toString())
}

tasks {
assemble {
dependsOn(reobfJar)
}
}
2 changes: 2 additions & 0 deletions idofront-nms/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ plugins {
alias(libs.plugins.kotlinx.serialization)
}

paperweight.reobfArtifactConfiguration = io.papermc.paperweight.userdev.ReobfArtifactConfiguration.MOJANG_PRODUCTION

run {}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ package com.mineinabyss.idofront.nms.aliases
import net.minecraft.server.level.ServerLevel
import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.level.Level
import org.bukkit.craftbukkit.v1_20_R3.CraftWorld
import org.bukkit.craftbukkit.v1_20_R3.entity.*
import org.bukkit.craftbukkit.v1_20_R3.inventory.CraftInventoryPlayer
import org.bukkit.craftbukkit.v1_20_R3.inventory.CraftItemStack
import org.bukkit.craftbukkit.CraftWorld
import org.bukkit.craftbukkit.entity.*
import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer
import org.bukkit.craftbukkit.inventory.CraftItemStack
import org.bukkit.entity.*
import org.bukkit.inventory.ItemStack
import org.bukkit.inventory.PlayerInventory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package com.mineinabyss.idofront.nms.nbt

import com.mineinabyss.idofront.nms.aliases.NMSItemStack
import com.mineinabyss.idofront.nms.aliases.toNMS
import net.minecraft.core.component.DataComponentType
import net.minecraft.core.component.DataComponents
import net.minecraft.nbt.CompoundTag
import org.bukkit.inventory.ItemStack

val NMSItemStack.hasPDC: Boolean get() = tag?.contains("PublicBukkitValues") == true
val NMSItemStack.hasPDC: Boolean get() = components.get(DataComponents.CUSTOM_DATA)?.unsafe?.contains("PublicBukkitValues") == true
val NMSItemStack.fastPDC: WrappedPDC?
get() {
return WrappedPDC((tag?.get("PublicBukkitValues") ?: return null) as CompoundTag)
return WrappedPDC(components.get(DataComponents.CUSTOM_DATA)?.unsafe?.getCompound("PublicBukkitValues") ?: return null)
}

val ItemStack.fastPDC get() = toNMS()?.fastPDC
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ import net.minecraft.nbt.CompoundTag
import net.minecraft.nbt.NbtIo
import org.bukkit.Bukkit
import org.bukkit.OfflinePlayer
import org.bukkit.craftbukkit.v1_20_R3.CraftServer
import org.bukkit.craftbukkit.CraftServer
import java.io.File
import java.nio.file.Files
import java.util.*

/**
* Gets the PlayerData from file for this UUID.
* Gets the PlayerData from file for this OfflinePlayer.
*/
fun UUID.getOfflinePlayerData(): CompoundTag? = (Bukkit.getServer() as CraftServer).server.playerDataStorage.getPlayerData(this.toString())
fun OfflinePlayer.getOfflinePlayerData(): CompoundTag? = (Bukkit.getServer() as CraftServer).server.playerDataStorage.load(name, uniqueId.toString()).orElse(null)

/**
* Gets a copy of the WrappedPDC for this OfflinePlayer.
* Care should be taken to ensure that the player is not online when this is called.
*/
fun OfflinePlayer.getOfflinePDC() : WrappedPDC? {
if (isOnline) return null
val baseTag = uniqueId.getOfflinePlayerData()?.getCompound("BukkitValues") ?: return null
val baseTag = getOfflinePlayerData()?.getCompound("BukkitValues") ?: return null
return WrappedPDC(baseTag)
}

Expand All @@ -35,7 +35,7 @@ fun OfflinePlayer.saveOfflinePDC(pdc: WrappedPDC): Boolean {
val tempFile = File(worldNBTStorage.playerDir, "$uniqueId.dat.tmp")
val playerFile = File(worldNBTStorage.playerDir, "$uniqueId.dat")

val mainPDc = uniqueId.getOfflinePlayerData() ?: return false
val mainPDc = getOfflinePlayerData() ?: return false
mainPDc.put("BukkitValues", pdc.compoundTag) ?: return false
runCatching {
Files.newOutputStream(tempFile.toPath()).use { outStream ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import net.minecraft.nbt.CompoundTag
import net.minecraft.nbt.NbtIo
import net.minecraft.nbt.Tag
import org.bukkit.NamespacedKey
import org.bukkit.craftbukkit.v1_20_R3.persistence.CraftPersistentDataAdapterContext
import org.bukkit.craftbukkit.v1_20_R3.persistence.CraftPersistentDataTypeRegistry
import org.bukkit.craftbukkit.persistence.CraftPersistentDataAdapterContext
import org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry
import org.bukkit.persistence.PersistentDataAdapterContext
import org.bukkit.persistence.PersistentDataContainer
import org.bukkit.persistence.PersistentDataType
Expand Down
Loading