Skip to content

Commit

Permalink
fix crash when checking migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
isXander committed Dec 17, 2022
1 parent 15bb043 commit fc74a0d
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 9 deletions.
7 changes: 2 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ plugins {
}

group = "dev.isxander"
version = "2.9.1"
version = "2.9.2"

repositories {
mavenCentral()
Expand Down Expand Up @@ -105,7 +105,7 @@ if (modrinthId.isNotEmpty()) {
versionNumber.set("${project.version}")
versionType.set("release")
uploadFile.set(tasks["remapJar"])
gameVersions.set(listOf("1.19", "1.19.1", "1.19.2", "1.19.3"))
gameVersions.set(listOf("1.19.3"))
loaders.set(listOf("fabric", "quilt"))
changelog.set(changelogText)
syncBodyFrom.set(file("README.md").readText())
Expand All @@ -129,9 +129,6 @@ if (hasProperty("curseforge.token") && curseforgeId.isNotEmpty()) {

id = curseforgeId
releaseType = "release"
addGameVersion("1.19")
addGameVersion("1.19.1")
addGameVersion("1.19.2")
addGameVersion("1.19.3")
addGameVersion("Fabric")
addGameVersion("Quilt")
Expand Down
1 change: 1 addition & 0 deletions changelogs/2.9.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fix crash when checking migrations
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fabric_loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric_l

fabric_api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric_api" }
fabric_language_kotlin = { module = "net.fabricmc:fabric-language-kotlin", version.ref = "fabric_language_kotlin" }
ktoml_core = { module = "com.akuleshov7:ktoml-core", version.ref = "ktoml" }
ktoml_core = { module = "com.akuleshov7:ktoml-core-jvm", version.ref = "ktoml" }
yet_another_config_lib = { module = "dev.isxander:yet-another-config-lib", version.ref = "yet_another_config_lib" }
mod_menu = { module = "com.terraformersmc:modmenu", version.ref = "mod_menu" }
mixin_extras = { module = "com.github.llamalad7:mixinextras", version.ref = "mixin_extras" }
Expand Down
10 changes: 9 additions & 1 deletion src/main/kotlin/dev/isxander/zoomify/config/ZoomifySettings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,15 @@ object ZoomifySettings : SettxiFileConfig(
}

yaclButton({
Migrator.checkMigrations()
if (!Migrator.checkMigrations()) {
val client = MinecraftClient.getInstance()
client.toastManager.add(SystemToast.create(
client,
SystemToast.Type.TUTORIAL_HINT,
Text.translatable("zoomify.gui.title"),
Text.translatable("zoomify.migrate.no_migrations")
))
}
}) {
name = "zoomify.gui.checkMigrations.name"
yaclButtonText = Text.translatable("zoomify.gui.checkMigrations.button")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ interface Migrator {
companion object {
val MIGRATORS = listOf<Migrator>(OkZoomerMigrator)

fun checkMigrations() {
fun checkMigrations(): Boolean {
val available = MIGRATORS.filter { it.isMigrationAvailable() }

if (available.isEmpty())
return
return false

var lastScreen = MinecraftClient.getInstance().currentScreen

Expand All @@ -27,6 +27,7 @@ interface Migrator {
}

MinecraftClient.getInstance().setScreen(lastScreen)
return true
}
}
}
1 change: 1 addition & 0 deletions src/main/resources/assets/zoomify/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
"zoomify.toast.unbindConflicting.description": "Zoomify unbound key called '%s' because it was conflicting with the zoom key.",


"zoomify.migrate.no_migrations": "No migrations available.",
"zoomify.migrate.result.title": "Migration completed",
"zoomify.migrate.restart": "Restart required",
"zoomify.migrate.result.restart_game": "Restart Game",
Expand Down

0 comments on commit fc74a0d

Please sign in to comment.