diff --git a/bootstrap/bukkit/build.gradle.kts b/bootstrap/bukkit/build.gradle.kts index 52af47d1..2f613be1 100644 --- a/bootstrap/bukkit/build.gradle.kts +++ b/bootstrap/bukkit/build.gradle.kts @@ -48,7 +48,7 @@ dependencies { exclude("com.google.guava") exclude("com.google.code.gson") } - compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.9") { + compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.12") { exclude("com.google.guava") exclude("com.google.code.gson") } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 3e7a8103..cb8bef46 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -14,8 +14,7 @@ dependencies { implementation("me.lucko:jar-relocator:1.7") { exclude("org.ow2.asm") } - implementation("org.ow2.asm:asm:9.7.1") - implementation("org.ow2.asm:asm-commons:9.7.1") + implementation(libs.bundles.asm) implementation("org.jetbrains.dokka:dokka-gradle-plugin:2.0.0") implementation("com.vanniktech.maven.publish:com.vanniktech.maven.publish.gradle.plugin:0.30.0") } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Extensions.kt b/buildSrc/src/main/kotlin/Extensions.kt index 3d5c05da..6209baef 100644 --- a/buildSrc/src/main/kotlin/Extensions.kt +++ b/buildSrc/src/main/kotlin/Extensions.kt @@ -7,7 +7,7 @@ import org.gradle.kotlin.dsl.attributes import java.io.File import java.time.LocalDateTime -val buildNumber: String? = System.getenv("BUILD_NUMBER") +val BUILD_NUMBER: String? = System.getenv("BUILD_NUMBER") val SUPPORTED_MINECRAFT_VERSION = listOf( //1.19 @@ -35,14 +35,14 @@ val SUPPORTED_MINECRAFT_VERSION = listOf( val Project.libs get() = rootProject.extensions.getByName("libs") as LibrariesForLibs -fun Jar.setManifest() { +fun Jar.setManifest(version: String, gradle: String) { manifest { attributes( - "Dev-Build" to (buildNumber != null), - "Version" to project.version, + "Dev-Build" to (BUILD_NUMBER != null), + "Version" to version, "Author" to "toxicity188", "Url" to "https://github.com/toxicity188/BetterHud", - "Created-By" to "Gradle ${project.gradle.gradleVersion}", + "Created-By" to "Gradle $gradle", "Build-Jdk" to "${System.getProperty("java.vendor")} ${System.getProperty("java.version")}", "Build-OS" to "${System.getProperty("os.arch")} ${System.getProperty("os.name")}", "Build-Date" to LocalDateTime.now().toString() @@ -50,7 +50,7 @@ fun Jar.setManifest() { } } -fun Jar.relocateAll() { +fun Jar.relocateAll(group: String) { val file = archiveFile.get().asFile val tempFile = file.copyTo(File.createTempFile("jar-relocator", System.currentTimeMillis().toString()).apply { if (exists()) delete() @@ -66,7 +66,7 @@ fun Jar.relocateAll() { "me.lucko.jarrelocator", "kr.toxicity.command.impl" ).map { - Relocation(it, "${project.group}.shaded.$it") + Relocation(it, "${group}.shaded.$it") } ).run() tempFile.delete() diff --git a/buildSrc/src/main/kotlin/bootstrap-conventions.gradle.kts b/buildSrc/src/main/kotlin/bootstrap-conventions.gradle.kts index e204ec84..d53e425f 100644 --- a/buildSrc/src/main/kotlin/bootstrap-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/bootstrap-conventions.gradle.kts @@ -20,6 +20,10 @@ val excludeDependencies = listOf( "annotations-13.0.jar" ) +val versionString = version.toString() +val versionGradle = gradle.gradleVersion +val groupString = group.toString() + tasks { jar { duplicatesStrategy = DuplicatesStrategy.EXCLUDE @@ -36,9 +40,9 @@ tasks { ) { exclude("META-INF/MANIFEST.MF") } - setManifest() + setManifest(versionString, versionGradle) doLast { - relocateAll() + relocateAll(groupString) } } } diff --git a/buildSrc/src/main/kotlin/standard-conventions.gradle.kts b/buildSrc/src/main/kotlin/standard-conventions.gradle.kts index 2d2bafcd..b57e066d 100644 --- a/buildSrc/src/main/kotlin/standard-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/standard-conventions.gradle.kts @@ -5,7 +5,7 @@ plugins { } group = "kr.toxicity.hud" -version = "1.11.3" + (buildNumber?.let { ".$it" } ?: "") +version = "1.11.3" + (BUILD_NUMBER?.let { ".$it" } ?: "") val targetJavaVersion = 21 diff --git a/changelog/1.11.3.md b/changelog/1.11.3.md index 91255517..9059c604 100644 --- a/changelog/1.11.3.md +++ b/changelog/1.11.3.md @@ -1,9 +1,11 @@ # BetterHud 1.11.3 ### Fix -- Fix mmocore skill reference. -- Add z-axis for NeoForge. +- Fix mmocore skill reference +- Add z-axis for NeoForge +- Clean build jar +- Fix image identifier ### Add -- Add 'turkish' language. -- Support combining Unicode. \ No newline at end of file +- Add 'turkish' language +- Support combining Unicode \ No newline at end of file diff --git a/dist/src/main/kotlin/kr/toxicity/hud/image/enums/ImageType.kt b/dist/src/main/kotlin/kr/toxicity/hud/image/enums/ImageType.kt index cbafb2b2..092f7c9a 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/image/enums/ImageType.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/image/enums/ImageType.kt @@ -75,6 +75,7 @@ enum class ImageType { SplitType.valueOf(splitType.uppercase()) }.getOrNull() } ?: SplitType.LEFT + val split = yamlObject.getAsInt("split", 25).coerceAtLeast(1) val getFile = File( assets, yamlObject["file"]?.asString().ifNull("file value not set.") @@ -87,7 +88,7 @@ enum class ImageType { .toImage() .removeEmptySide() .ifNull("Invalid image.") - .toNamed(getFile.name), yamlObject.getAsInt("split", 25).coerceAtLeast(1) + .toNamed("${getFile.nameWithoutExtension}_${splitType.name.lowercase()}_$split.png"), split ), this, yamlObject["setting"]?.asObject() diff --git a/dist/src/main/kotlin/kr/toxicity/hud/util/Adventures.kt b/dist/src/main/kotlin/kr/toxicity/hud/util/Adventures.kt index f48f4df0..89969a3f 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/util/Adventures.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/util/Adventures.kt @@ -104,6 +104,9 @@ private class SplitBuilder( isClean = true return build } + fun style(style: Style) { + builder.style(style) + } fun append(like: ComponentLike) { builder.append(like) isClean = false @@ -158,14 +161,15 @@ fun Component.split(option: SplitOption, charWidth: (Pair) -> Int?): } val sb = StringBuilder() + subBuilder.style(style) fun end() { subBuilder.accept { - style(style).content(sb.toString()) + content(sb.toString()) } sb.setLength(0) } fun add(component: ComponentLike) { - subBuilder.append(Component.text().style(style).content(sb.toString())) + subBuilder.append(Component.text().content(sb.toString())) subBuilder.append(component) sb.setLength(0) } @@ -186,7 +190,7 @@ fun Component.split(option: SplitOption, charWidth: (Pair) -> Int?): if (i >= option.endWidth && (i >= (1.25 * option.endWidth).roundToInt() || ' '.code == codepoint) || option.forceSplit) end() } if (!subBuilder.isClean || sb.isNotEmpty()) target.append(subBuilder.build { - style(style).content(sb.toString()) + content(sb.toString()) }) for (child in children()) { child.parse(subBuilder, subBold, subItalic) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c197d500..ba944c9e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,9 +11,11 @@ bstats = "3.1.0" betterCommand = "1.4.2" resourceFactory = "1.2.0" loom = "1.9-SNAPSHOT" -paperweight = "2.0.0-beta.11" +paperweight = "2.0.0-beta.12" minotaur = "2.8.7" +asm = "9.7.1" + [libraries] adventureApi = { group = "net.kyori", name = "adventure-api", version.ref = "adventure" } adventureMinimessage = { group = "net.kyori", name = "adventure-text-minimessage", version.ref = "adventure" } @@ -36,6 +38,9 @@ kotlinJvm = { group = "org.jetbrains.kotlin.jvm", name = "org.jetbrains.kotlin.j kotlinStdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" } minotaur = { group = "com.modrinth.minotaur", name = "com.modrinth.minotaur.gradle.plugin", version.ref = "minotaur"} +asm = { group = "org.ow2.asm", name = "asm", version.ref = "asm" } +asmCommons = { group = "org.ow2.asm", name = "asm-commons", version.ref = "asm" } + [plugins] standardConvention = { id = "standard-conventions" } apiConvention = { id = "api-conventions" } @@ -61,4 +66,8 @@ library = [ "gson", "exp4j", "expiringmap" +] +asm = [ + "asm", + "asmCommons" ] \ No newline at end of file