Skip to content

Commit

Permalink
small config thing
Browse files Browse the repository at this point in the history
  • Loading branch information
DeDiamondPro committed Oct 18, 2022
1 parent a17daea commit 74d7681
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/main/kotlin/dev/dediamondpro/skyguide/SkyGuide.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import net.minecraftforge.client.ClientCommandHandler
import net.minecraftforge.common.MinecraftForge
import net.minecraftforge.fml.common.Mod
import net.minecraftforge.fml.common.event.FMLInitializationEvent
import java.io.File

@Mod(
modid = SkyGuide.ID,
Expand All @@ -28,7 +27,6 @@ object SkyGuide {

@Mod.EventHandler
fun onInitialization(event: FMLInitializationEvent) {
File("./config/$ID").mkdirs()
Config.preload()
if (Config.downloadAtLaunch) AssetHandler.initialize()
KeyBindHandler.init()
Expand Down
13 changes: 10 additions & 3 deletions src/main/kotlin/dev/dediamondpro/skyguide/config/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@ package dev.dediamondpro.skyguide.config
import dev.dediamondpro.skyguide.SkyGuide
import dev.dediamondpro.skyguide.handlers.AssetHandler
import dev.dediamondpro.skyguide.utils.TickDelay
import dev.dediamondpro.skyguide.utils.Waypoint
import dev.dediamondpro.skyguide.utils.toFile
import gg.essential.vigilance.Vigilant
import gg.essential.vigilance.data.Property
import gg.essential.vigilance.data.PropertyType
import java.io.File

object Config : Vigilant("./config/${SkyGuide.ID}/config.toml".toFile(), SkyGuide.NAME) {
private val configFile by lazy {
val parent = File("config", "skyguide")
if (!parent.exists() && !parent.mkdirs())
throw IllegalStateException("Could not create config directory.")

File(parent, "skyguide.toml")
}

object Config : Vigilant(configFile, SkyGuide.NAME) {

// General

Expand Down

0 comments on commit 74d7681

Please sign in to comment.