Skip to content

Commit

Permalink
Fix image identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
toxicity188 committed Jan 7, 2025
1 parent b00df4d commit 9b42c73
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 22 deletions.
2 changes: 1 addition & 1 deletion bootstrap/bukkit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
3 changes: 1 addition & 2 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
14 changes: 7 additions & 7 deletions buildSrc/src/main/kotlin/Extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -35,22 +35,22 @@ 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()
)
}
}

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()
Expand All @@ -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()
Expand Down
8 changes: 6 additions & 2 deletions buildSrc/src/main/kotlin/bootstrap-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -36,9 +40,9 @@ tasks {
) {
exclude("META-INF/MANIFEST.MF")
}
setManifest()
setManifest(versionString, versionGradle)
doLast {
relocateAll()
relocateAll(groupString)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/standard-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 6 additions & 4 deletions changelog/1.11.3.md
Original file line number Diff line number Diff line change
@@ -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.
- Add 'turkish' language
- Support combining Unicode
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand All @@ -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()
Expand Down
10 changes: 7 additions & 3 deletions dist/src/main/kotlin/kr/toxicity/hud/util/Adventures.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -158,14 +161,15 @@ fun Component.split(option: SplitOption, charWidth: (Pair<Style, Int>) -> 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)
}
Expand All @@ -186,7 +190,7 @@ fun Component.split(option: SplitOption, charWidth: (Pair<Style, Int>) -> 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)
Expand Down
11 changes: 10 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand All @@ -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" }
Expand All @@ -61,4 +66,8 @@ library = [
"gson",
"exp4j",
"expiringmap"
]
asm = [
"asm",
"asmCommons"
]

0 comments on commit 9b42c73

Please sign in to comment.