From 7a05a7449e912f2edda0b5fca3f73e725f67d40d Mon Sep 17 00:00:00 2001 From: TheBjoRedCraft Date: Sat, 25 Jul 2026 11:58:56 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=20feat(minimessage):=20add=20smal?= =?UTF-8?q?l=20caps=20tag=20for=20MiniMessage=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - introduce SmallCapsTag to convert text to small caps using toSmallCaps function - update miniMessage method to include new "small" tag for text formatting - enhance smallCapsMap visibility by changing it to internal --- gradle.properties | 2 +- .../dev/slne/surf/api/core/font/small-caps.kt | 2 +- .../core/minimessage/SurfMiniMessageHolder.kt | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 5073cfc6b..23423054f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,6 +7,6 @@ org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled javaVersion=25 mcVersion=26.2 group=dev.slne.surf.api -version=3.33.4 +version=3.33.5 relocationPrefix=dev.slne.surf.api.libs snapshot=false diff --git a/surf-api-core/surf-api-core/src/main/kotlin/dev/slne/surf/api/core/font/small-caps.kt b/surf-api-core/surf-api-core/src/main/kotlin/dev/slne/surf/api/core/font/small-caps.kt index 440902e07..72c333f3c 100644 --- a/surf-api-core/surf-api-core/src/main/kotlin/dev/slne/surf/api/core/font/small-caps.kt +++ b/surf-api-core/surf-api-core/src/main/kotlin/dev/slne/surf/api/core/font/small-caps.kt @@ -8,7 +8,7 @@ import dev.slne.surf.api.core.util.char2CharMapOf * Maps lowercase letters a-z to their corresponding small caps characters (ᴀ-ᴢ) and preserves digits 0-9. * Some letters like 's' and 'x' map to themselves as they lack distinct small caps Unicode characters. */ -private val smallCapsMap = char2CharMapOf( +internal val smallCapsMap = char2CharMapOf( 'a' to 'ᴀ', 'b' to 'ʙ', 'c' to 'ᴄ', 'd' to 'ᴅ', 'e' to 'ᴇ', 'f' to 'ғ', 'g' to 'ɢ', 'h' to 'ʜ', 'i' to 'ɪ', 'j' to 'ᴊ', 'k' to 'ᴋ', 'l' to 'ʟ', 'm' to 'ᴍ', 'n' to 'ɴ', 'o' to 'ᴏ', 'p' to 'ᴘ', 'q' to 'ǫ', 'r' to 'ʀ', diff --git a/surf-api-core/surf-api-core/src/main/kotlin/dev/slne/surf/api/core/minimessage/SurfMiniMessageHolder.kt b/surf-api-core/surf-api-core/src/main/kotlin/dev/slne/surf/api/core/minimessage/SurfMiniMessageHolder.kt index ddfe3fe1e..a25a1e6f2 100644 --- a/surf-api-core/surf-api-core/src/main/kotlin/dev/slne/surf/api/core/minimessage/SurfMiniMessageHolder.kt +++ b/surf-api-core/surf-api-core/src/main/kotlin/dev/slne/surf/api/core/minimessage/SurfMiniMessageHolder.kt @@ -1,8 +1,12 @@ package dev.slne.surf.api.core.minimessage +import dev.slne.surf.api.core.font.toSmallCaps import dev.slne.surf.api.core.messages.Colors +import net.kyori.adventure.text.Component +import net.kyori.adventure.text.TextComponent import net.kyori.adventure.text.format.TextColor import net.kyori.adventure.text.minimessage.MiniMessage +import net.kyori.adventure.text.minimessage.tag.Modifying import net.kyori.adventure.text.minimessage.tag.Tag /** @@ -45,6 +49,7 @@ object SurfMiniMessageHolder { "primary" to Colors.PRIMARY, "secondary" to Colors.SECONDARY, "info" to Colors.INFO, + "note" to Colors.NOTE, "success" to Colors.SUCCESS, "warning" to Colors.WARNING, "error" to Colors.ERROR, @@ -72,6 +77,8 @@ object SurfMiniMessageHolder { Tag.selfClosingInserting(prefix) } + + tagBuilder.tag("small") { _, _ -> SmallCapsTag() } } .build() @@ -89,6 +96,16 @@ object SurfMiniMessageHolder { * @return The MiniMessage parser with custom Surf API tags */ fun miniMessage() = minimessage + + private class SmallCapsTag : Modifying { + override fun apply(current: Component, depth: Int): Component { + if (current is TextComponent) { + return current.content(current.content().toSmallCaps()) + .children(emptyList()) + } + return current.children(emptyList()) + } + } } /** From d202af35c198077b575143965ec3156cf9005bde Mon Sep 17 00:00:00 2001 From: TheBjoRedCraft Date: Sat, 25 Jul 2026 11:59:09 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9C=A8=20feat(minimessage):=20add=20smal?= =?UTF-8?q?l=20caps=20tag=20for=20MiniMessage=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - introduce SmallCapsTag to convert text to small caps using toSmallCaps function - update miniMessage method to include new "small" tag for text formatting - enhance smallCapsMap visibility by changing it to internal --- .../src/main/kotlin/dev/slne/surf/api/core/font/small-caps.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/surf-api-core/surf-api-core/src/main/kotlin/dev/slne/surf/api/core/font/small-caps.kt b/surf-api-core/surf-api-core/src/main/kotlin/dev/slne/surf/api/core/font/small-caps.kt index 72c333f3c..440902e07 100644 --- a/surf-api-core/surf-api-core/src/main/kotlin/dev/slne/surf/api/core/font/small-caps.kt +++ b/surf-api-core/surf-api-core/src/main/kotlin/dev/slne/surf/api/core/font/small-caps.kt @@ -8,7 +8,7 @@ import dev.slne.surf.api.core.util.char2CharMapOf * Maps lowercase letters a-z to their corresponding small caps characters (ᴀ-ᴢ) and preserves digits 0-9. * Some letters like 's' and 'x' map to themselves as they lack distinct small caps Unicode characters. */ -internal val smallCapsMap = char2CharMapOf( +private val smallCapsMap = char2CharMapOf( 'a' to 'ᴀ', 'b' to 'ʙ', 'c' to 'ᴄ', 'd' to 'ᴅ', 'e' to 'ᴇ', 'f' to 'ғ', 'g' to 'ɢ', 'h' to 'ʜ', 'i' to 'ɪ', 'j' to 'ᴊ', 'k' to 'ᴋ', 'l' to 'ʟ', 'm' to 'ᴍ', 'n' to 'ɴ', 'o' to 'ᴏ', 'p' to 'ᴘ', 'q' to 'ǫ', 'r' to 'ʀ',