Skip to content

Commit

Permalink
Renamed AltAccount.Cracked to AltAccount.Offline, added translation f…
Browse files Browse the repository at this point in the history
…or alt type
  • Loading branch information
ya-ilya committed Sep 22, 2023
1 parent 0419a48 commit 024c3f0
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package org.progreso.api.alt
sealed class AltAccount(val username: String) {
val type: String = javaClass.simpleName

class Cracked(username: String) : AltAccount(username)
class Offline(username: String) : AltAccount(username)
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class AltConfigCategory : AbstractConfigCategory<AltConfig>(

alts.add(
when (type) {
"Cracked" -> AltAccount.Cracked(username)
else -> throw RuntimeException()
"Offline" -> AltAccount.Offline(username)
else -> throw IllegalArgumentException()
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class ProgresoAltsScreen(private val alts: Set<AltAccount>) : TitledScreen(i18n
button.dimensions(width / 2 - 66, height / 2 + 8, 132, 20)
button.onPress {
if (name.text.length >= 3) {
AltManager.addAlt(AltAccount.Cracked(name.text))
AltManager.addAlt(AltAccount.Offline(name.text))
close()
}
}
Expand Down Expand Up @@ -128,7 +128,9 @@ class ProgresoAltsScreen(private val alts: Set<AltAccount>) : TitledScreen(i18n
)
drawText(
mc.textRenderer,
i18n("gui.alts.label.alt_type", alt.type),
i18n("gui.alts.label.alt_type", when (alt) {
is AltAccount.Offline -> i18n("gui.alts.label.offline_alt_type")
}),
x + 3,
y + 26 - mc.textRenderer.fontHeight,
Color.WHITE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ object SessionUtil {

fun login(alt: AltAccount): LoginResult {
return when (alt) {
is AltAccount.Cracked -> loginCracked(alt.username)
is AltAccount.Offline -> loginOffline(alt.username)
else -> LoginResult.Error
}
}

private fun loginCracked(username: String): LoginResult {
private fun loginOffline(username: String): LoginResult {
return try {
mc.session = Session(
username,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"gui.alts.title.create_alt": "Create Alt",
"gui.alts.label.alt_name": "Name: %s",
"gui.alts.label.alt_type": "Type: %s",
"gui.alts.label.offline_alt_type": "Offline",
"gui.alts.label.current_name": "Current name: %s",
"gui.alts.label.name_text_field": "Name",
"gui.alts.button.add_account": "Add account",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"gui.alts.title.create_alt": "Создать альт",
"gui.alts.label.alt_name": "Имя: %s",
"gui.alts.label.alt_type": "Тип: %s",
"gui.alts.label.offline_alt_type": "Оффлайн",
"gui.alts.label.current_name": "Текущее имя: %s",
"gui.alts.label.name_text_field": "Имя",
"gui.alts.button.add_account": "Добавить аккаунт",
Expand Down

0 comments on commit 024c3f0

Please sign in to comment.