diff options
author | nea <nea@nea.moe> | 2023-05-24 02:29:20 +0200 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-05-24 02:29:20 +0200 |
commit | 5984383d2c48b4ae84bac1827bc6ca1891af8cf0 (patch) | |
tree | 90aaae93147ce7aad48777be488039626b70512a /src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt | |
parent | 5ff50799b6c8baf6dd87ecbf44860d19a4acceab (diff) | |
download | Firmament-5984383d2c48b4ae84bac1827bc6ca1891af8cf0.tar.gz Firmament-5984383d2c48b4ae84bac1827bc6ca1891af8cf0.tar.bz2 Firmament-5984383d2c48b4ae84bac1827bc6ca1891af8cf0.zip |
Common config gui
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt')
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt b/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt index b1091fc..ea77fc1 100644 --- a/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt +++ b/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt @@ -8,8 +8,6 @@ import io.github.moulberry.repo.data.NEUItem import io.github.moulberry.repo.data.NEURecipe import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents import kotlinx.coroutines.launch -import kotlinx.serialization.Serializable -import kotlinx.serialization.serializer import net.minecraft.client.MinecraftClient import net.minecraft.network.packet.s2c.play.SynchronizeRecipesS2CPacket import net.minecraft.text.Text @@ -17,16 +15,21 @@ import moe.nea.firmament.Firmament import moe.nea.firmament.Firmament.logger import moe.nea.firmament.hud.ProgressBar import moe.nea.firmament.util.SkyblockId -import moe.nea.firmament.util.data.DataHolder - -object RepoManager : DataHolder<RepoManager.Config>(serializer(), "repo", ::Config) { - @Serializable - data class Config( - var user: String = "NotEnoughUpdates", - var repo: String = "NotEnoughUpdates-REPO", - var autoUpdate: Boolean = true, - var branch: String = "dangerous", - ) +import moe.nea.firmament.gui.config.ManagedConfig + +object RepoManager { + object Config : ManagedConfig("repo") { + var username by string("username") { "NotEnoughUpdates" } + var reponame by string("reponame") { "NotEnoughUpdates-REPO" } + var branch by string("branch") { "prerelease" } + val autoUpdate by toggle("autoUpdate") { true } + val reset by button("reset") { + username = "NotEnoughUpdates" + reponame = "NotEnoughUpdates-REPO" + branch = "prerelease" + save() + } + } val currentDownloadedSha by RepoDownloadManager::latestSavedVersionHash @@ -93,7 +96,7 @@ object RepoManager : DataHolder<RepoManager.Config>(serializer(), "repo", ::Conf } fun initialize() { - if (data.autoUpdate) { + if (Config.autoUpdate) { launchAsyncUpdate() } else { reload() |