Skip to content

Commit

Permalink
Fixed messages with translations
Browse files Browse the repository at this point in the history
  • Loading branch information
DrexHD committed Oct 29, 2024
1 parent 6047de3 commit 294c6bb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.0.1] - 2024-10-29
### Fixed
- Messages with translations

## [2.0.0] - 2024-09-30
Initial public release
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Mod
modName = BlockBot Discord
modId = blockbot-discord
modVersion = 2.0.0
modVersion = 2.0.1
mavenGroup = io.github.quiltservertools

# Other
Expand Down
10 changes: 5 additions & 5 deletions libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[versions]
minecraft = "1.21.2-rc2"
curseforge-minecraft="1.21.2-Snapshot"
minecraft = "1.21.3"
curseforge-minecraft="1.21.3"
fabric-loader = "0.16.7"
yarn-mappings = "1.21.2-rc2+build.2"
yarn-mappings = "1.21.3+build.2"

fabric-api = "0.106.1+1.21.2"
fabric-api = "0.107.0+1.21.3"

# Kotlin
fabric-kotlin = "1.12.1+kotlin.2.0.20"
Expand All @@ -13,7 +13,7 @@ fabric-kotlin = "1.12.1+kotlin.2.0.20"
kord-extensions = "1.9.0-SNAPSHOT"
mc-discord-reserializer = "4.3.0"
emoji-java = "5.1.1"
adventure-gson = "4.16.0"
adventure-gson = "4.17.0"

placeholder-api = "2.5.0+1.21.2"
permission-api = "0.3.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ class BlockBotApiExtension : Extension(), Bot {
.addRenderer(MentionToMinecraftRenderer(bot))
)
private val discordSerializer = DiscordSerializer(
DiscordSerializerOptions.defaults().withKeybindProvider { Text.translatable(it.keybind()).string }
DiscordSerializerOptions.defaults()
.withKeybindProvider { Text.translatable(it.keybind()).string }
.withTranslationProvider { it.toNative(server.registryManager).string }
)
private val server: MinecraftServer by inject()
private val mentions = AllowedMentionsBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fun Message.summary(): String {

fun GameProfile.getTextures() = Iterables.getFirst(this.properties.get("textures"), null)?.value

fun Component.toNative(wrapperLookup: RegistryWrapper.WrapperLookup): MutableText = Text.Serialization.fromJson(GsonComponentSerializer.gson().serialize(this), DynamicRegistryManager.EMPTY)?: Text.empty()
fun Component.toNative(wrapperLookup: RegistryWrapper.WrapperLookup): MutableText = Text.Serialization.fromJson(GsonComponentSerializer.gson().serialize(this), wrapperLookup)?: Text.empty()

fun Text.toAdventure(wrapperLookup: RegistryWrapper.WrapperLookup) = GsonComponentSerializer.gson().deserialize(Text.Serialization.toJsonString(this, wrapperLookup))

Expand Down

0 comments on commit 294c6bb

Please sign in to comment.