Fix crash when rendering SkyBlock id in a string

This commit is contained in:
Linnea Gräf
2024-02-09 12:00:50 +01:00
parent 0cb6e308ac
commit efbef71213
14 changed files with 55 additions and 87 deletions

View File

@@ -27,7 +27,7 @@ class HudMetaHandler(val config: ManagedConfig, val label: MutableText, val widt
}
override fun emitGuiElements(opt: ManagedOption<HudMeta>, guiAppender: GuiAppender) {
guiAppender.appendLabeledRow(opt.labelText, WButton(Text.translatable("firmament.hud.edit", label))
guiAppender.appendLabeledRow(opt.labelText, WButton(Text.stringifiedTranslatable("firmament.hud.edit", label))
.also {
it.setOnClick {
MC.screen = JarvisIntegration.jarvis.getHudEditor(

View File

@@ -44,31 +44,31 @@ class ProfileViewer(
companion object {
suspend fun onCommand(source: FabricClientCommandSource, name: String) {
source.sendFeedback(Text.translatable("firmament.pv.lookingup", name))
source.sendFeedback(Text.stringifiedTranslatable("firmament.pv.lookingup", name))
try {
val uuid = Routes.getUUIDForPlayerName(name)
if (uuid == null) {
source.sendError(Text.translatable("firmament.pv.noplayer", name))
source.sendError(Text.stringifiedTranslatable("firmament.pv.noplayer", name))
return
}
val name = Routes.getPlayerNameForUUID(uuid) ?: name
val names = mapOf(uuid to (name))
val data = Routes.getAccountData(uuid)
if (data == null) {
source.sendError(Text.translatable("firmament.pv.noprofile", name))
source.sendError(Text.stringifiedTranslatable("firmament.pv.noprofile", name))
return
}
val accountData = mapOf(data.uuid to data)
val profiles = Routes.getProfiles(uuid)
val profile = profiles?.profiles?.find { it.selected }
if (profile == null) {
source.sendFeedback(Text.translatable("firmament.pv.noprofile", name))
source.sendFeedback(Text.stringifiedTranslatable("firmament.pv.noprofile", name))
return
}
ScreenUtil.setScreenLater(CottonClientScreen(ProfileViewer(uuid, names, accountData, profile)))
} catch (e: Exception) {
Firmament.logger.error("Error loading profile data for $name", e)
source.sendError(Text.translatable("firmament.pv.badprofile", name, e.message))
source.sendError(Text.stringifiedTranslatable("firmament.pv.badprofile", name, e.message))
}
}
}

View File

@@ -49,7 +49,7 @@ object SkillPage : ProfilePage {
) {
override fun addTooltip(tooltip: TooltipBuilder) {
tooltip.add(Text.literal("$level/$maxLevel"))
tooltip.add(Text.translatable("firmament.pv.skills.total", FirmFormatters.formatCurrency(exp, 1)))
tooltip.add(Text.stringifiedTranslatable("firmament.pv.skills.total", FirmFormatters.formatCurrency(exp, 1)))
}
}
}