diff options
| author | Linnea Gräf <nea@nea.moe> | 2025-10-19 00:27:17 +0200 |
|---|---|---|
| committer | Linnea Gräf <nea@nea.moe> | 2025-10-19 00:27:17 +0200 |
| commit | 28c3ba952d69c8a654301c9211d536493513fdd5 (patch) | |
| tree | e5fc341fe7f12d2d5b7bc9d78474b9472d9af163 /src/main/kotlin/features/misc | |
| parent | 9036f2f09cab47bc78c0d7e5ae4909da745e07ec (diff) | |
| download | Firmament-28c3ba952d69c8a654301c9211d536493513fdd5.tar.gz Firmament-28c3ba952d69c8a654301c9211d536493513fdd5.tar.bz2 Firmament-28c3ba952d69c8a654301c9211d536493513fdd5.zip | |
fix: strings in mc bindings
Diffstat (limited to 'src/main/kotlin/features/misc')
| -rw-r--r-- | src/main/kotlin/features/misc/LicenseViewer.kt | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/main/kotlin/features/misc/LicenseViewer.kt b/src/main/kotlin/features/misc/LicenseViewer.kt index 4219177..7a43554 100644 --- a/src/main/kotlin/features/misc/LicenseViewer.kt +++ b/src/main/kotlin/features/misc/LicenseViewer.kt @@ -6,6 +6,7 @@ import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.Serializable import kotlinx.serialization.Transient import kotlinx.serialization.json.decodeFromStream +import net.minecraft.text.Text import moe.nea.firmament.Firmament import moe.nea.firmament.annotations.Subscribe import moe.nea.firmament.commands.thenExecute @@ -30,17 +31,18 @@ object LicenseViewer { fun hasWebPresence() = webPresence != null @Bind - fun webPresence() = webPresence ?: "<no web presence>" + fun webPresence() = Text.literal(webPresence ?: "<no web presence>") + @Bind fun open() { MC.openUrl(webPresence ?: return) } @Bind - fun projectName() = projectName + fun projectName() = Text.literal(projectName) @Bind - fun projectDescription() = projectDescription ?: "<no project description>" + fun projectDescription() = Text.literal(projectDescription ?: "<no project description>") @get:Bind("developers") @Transient @@ -53,10 +55,13 @@ object LicenseViewer { @Serializable data class Developer( - @get:Bind("name") val name: String, + val name: String, val webPresence: String? = null ) { + @Bind("name") + fun nameT() = Text.literal(name) + @Bind fun open() { MC.openUrl(webPresence ?: return) @@ -66,14 +71,17 @@ object LicenseViewer { fun hasWebPresence() = webPresence != null @Bind - fun webPresence() = webPresence ?: "<no web presence>" + fun webPresence() = Text.literal(webPresence ?: "<no web presence>") } @Serializable data class License( - @get:Bind("name") val licenseName: String, + val licenseName: String, val licenseUrl: String? = null ) { + @Bind("name") + fun nameG() = Text.literal(licenseName) + @Bind fun open() { MC.openUrl(licenseUrl ?: return) @@ -83,7 +91,7 @@ object LicenseViewer { fun hasUrl() = licenseUrl != null @Bind - fun url() = licenseUrl ?: "<no link to license text>" + fun url() = Text.literal(licenseUrl ?: "<no link to license text>") } data class LicenseList( |
