diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-04-20 14:27:42 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-04-20 14:27:42 +0200 |
commit | 06b32baf1c4ab950f113bee1985cb7ce1be02b27 (patch) | |
tree | b3fe68e3ceb046652d15bd5a88d3c5301a149dff /src/main | |
parent | 93a043f0f9c763f6a36de7e02ba57077f615a5a9 (diff) | |
download | skyhanni-06b32baf1c4ab950f113bee1985cb7ce1be02b27.tar.gz skyhanni-06b32baf1c4ab950f113bee1985cb7ce1be02b27.tar.bz2 skyhanni-06b32baf1c4ab950f113bee1985cb7ce1be02b27.zip |
Auto saving the config every minute
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt index de41a1e4b..f8152f8b8 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt @@ -2,8 +2,8 @@ package at.hannibal2.skyhanni.config import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.ConfigLoadEvent -import at.hannibal2.skyhanni.features.misc.update.UpdateManager import at.hannibal2.skyhanni.features.garden.CropType +import at.hannibal2.skyhanni.features.misc.update.UpdateManager import com.google.gson.GsonBuilder import io.github.moulberry.moulconfig.observer.PropertyTypeAdapterFactory import io.github.moulberry.moulconfig.processor.BuiltinMoulConfigGuis @@ -11,6 +11,7 @@ import io.github.moulberry.moulconfig.processor.ConfigProcessorDriver import io.github.moulberry.moulconfig.processor.MoulConfigProcessor import java.io.* import java.nio.charset.StandardCharsets +import kotlin.concurrent.fixedRateTimer class ConfigManager { companion object { @@ -27,6 +28,10 @@ class ConfigManager { lateinit var processor: MoulConfigProcessor<Features> fun firstLoad() { + fixedRateTimer(name = "config-auto-save", period = 60_000L) { + saveConfig() + } + try { configDirectory.mkdir() } catch (ignored: Exception) { |