aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMy-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>2021-09-16 10:33:31 -0400
committerMy-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>2021-09-16 13:50:49 -0400
commit221f3b5b189c17715fda828908da9255802fb66b (patch)
tree91ec9d7a366f1d6ac807616c8b96759c1905ec40 /src/main
parente3157d2d02a3f71c37b5158c412be6fcca1f4f85 (diff)
downloadSkytilsMod-221f3b5b189c17715fda828908da9255802fb66b.tar.gz
SkytilsMod-221f3b5b189c17715fda828908da9255802fb66b.tar.bz2
SkytilsMod-221f3b5b189c17715fda828908da9255802fb66b.zip
Revert "allow config loading in the coremod/tweaker stage"
This reverts commit 43531f6cfa3d29fda95c0944bc00abf635a5427b.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/kotlin/skytils/skytilsmod/Skytils.kt7
-rw-r--r--src/main/kotlin/skytils/skytilsmod/core/Config.kt45
-rw-r--r--src/main/kotlin/skytils/skytilsmod/tweaker/SkytilsLoadingPluginKt.kt2
3 files changed, 17 insertions, 37 deletions
diff --git a/src/main/kotlin/skytils/skytilsmod/Skytils.kt b/src/main/kotlin/skytils/skytilsmod/Skytils.kt
index 801b6393..7baadab9 100644
--- a/src/main/kotlin/skytils/skytilsmod/Skytils.kt
+++ b/src/main/kotlin/skytils/skytilsmod/Skytils.kt
@@ -20,7 +20,6 @@ package skytils.skytilsmod
import com.google.gson.Gson
import com.google.gson.GsonBuilder
-import gg.essential.vigilance.Vigilance
import gg.essential.vigilance.gui.SettingsGui
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.GuiButton
@@ -108,10 +107,8 @@ class Skytils {
val config = Config
- @JvmStatic
- val modDir by lazy {
- File(File(mc.mcDataDir, "config"), "skytils")
- }
+ @JvmField
+ val modDir = File(File(mc.mcDataDir, "config"), "skytils")
@JvmStatic
lateinit var guiManager: GuiManager
diff --git a/src/main/kotlin/skytils/skytilsmod/core/Config.kt b/src/main/kotlin/skytils/skytilsmod/core/Config.kt
index 84040fa6..247e71a3 100644
--- a/src/main/kotlin/skytils/skytilsmod/core/Config.kt
+++ b/src/main/kotlin/skytils/skytilsmod/core/Config.kt
@@ -18,7 +18,6 @@
package skytils.skytilsmod.core
import gg.essential.universal.UDesktop
-import gg.essential.vigilance.Vigilance
import gg.essential.vigilance.Vigilant
import gg.essential.vigilance.data.Category
import gg.essential.vigilance.data.Property
@@ -30,7 +29,6 @@ import skytils.skytilsmod.gui.SpiritLeapNamesGui
import java.awt.Color
import java.io.File
import java.net.URI
-import kotlin.concurrent.fixedRateTimer
object Config : Vigilant(File("./config/skytils/config.toml"), "Skytils", sortingBehavior = ConfigSorting) {
@@ -776,11 +774,11 @@ object Config : Vigilant(File("./config/skytils/config.toml"), "Skytils", sortin
)
var trackGaiaHits = false
- /* @Property(
- type = PropertyType.SWITCH, name = "Hide Leftover Bleeds",
- description = "Removes the bleeds text left behind when a player dies to a Minotaur.",
- category = "Events", subcategory = "Mythological"
- )*/
+/* @Property(
+ type = PropertyType.SWITCH, name = "Hide Leftover Bleeds",
+ description = "Removes the bleeds text left behind when a player dies to a Minotaur.",
+ category = "Events", subcategory = "Mythological"
+ )*/
var removeLeftOverBleeds = false
@Property(
@@ -2178,38 +2176,24 @@ object Config : Vigilant(File("./config/skytils/config.toml"), "Skytils", sortin
"seraphHitsPhaseColor",
"seraphNormalPhaseColor"
).forEach { propertyName -> addDependency(propertyName, "recolorSeraphBoss") }
- }
-
- fun startup() {
- try {
- this::class.java.superclass.getDeclaredMethod("readData").apply {
- isAccessible = true
- invoke(this@Config)
- }
- } catch (e: Throwable) {
- writeData()
- println("Failed to read Skytils config data")
- e.printStackTrace()
- }
-
- fixedRateTimer(period = 30 * 1000L) { writeData() }
-
- Runtime.getRuntime().addShutdownHook(Thread { writeData() })
- }
- fun init() {
- Vigilance.initialize()
registerListener("protectItemBINThreshold") { threshold: String ->
TickTask(1) {
val numeric = threshold.replace(Regex("[^0-9]"), "")
protectItemBINThreshold = numeric.ifEmpty { "0" }
}
}
+
registerListener("darkModeMist") { _: Boolean -> mc.renderGlobal.loadRenderers() }
registerListener("recolorCarpets") { _: Boolean -> mc.renderGlobal.loadRenderers() }
+
registerListener("apiKey") { key: String ->
Skytils.hylinAPI.key = key
}
+ }
+
+ fun init() {
+ initialize()
if (Skytils.config.lastLaunchedVersion != Skytils.VERSION) {
val ver = UpdateChecker.SkytilsVersion(Skytils.config.lastLaunchedVersion)
when {
@@ -2233,13 +2217,14 @@ object Config : Vigilant(File("./config/skytils/config.toml"), "Skytils", sortin
GuiManager.GUISCALES["Crystal Hollows Map"] = 1f
PersistentSave.markDirty<GuiManager>()
}
+ }
+ ver < UpdateChecker.SkytilsVersion("1.0.7") -> {
this.dataURL = "https://cdn.jsdelivr.net/gh/Skytils/SkytilsMod-Data@main/"
-
}
}
- Skytils.config.lastLaunchedVersion = Skytils.VERSION
- Skytils.config.markDirty()
}
+ Skytils.config.lastLaunchedVersion = Skytils.VERSION
+ Skytils.config.markDirty()
}
private object ConfigSorting : SortingBehavior() {
diff --git a/src/main/kotlin/skytils/skytilsmod/tweaker/SkytilsLoadingPluginKt.kt b/src/main/kotlin/skytils/skytilsmod/tweaker/SkytilsLoadingPluginKt.kt
index dfcd0c96..1f464be9 100644
--- a/src/main/kotlin/skytils/skytilsmod/tweaker/SkytilsLoadingPluginKt.kt
+++ b/src/main/kotlin/skytils/skytilsmod/tweaker/SkytilsLoadingPluginKt.kt
@@ -25,7 +25,6 @@ import org.apache.hc.client5.http.classic.methods.HttpGet
import org.apache.hc.core5.http.io.entity.EntityUtils
import org.spongepowered.asm.launch.MixinBootstrap
import org.spongepowered.asm.mixin.MixinEnvironment
-import skytils.skytilsmod.core.Config
import skytils.skytilsmod.utils.APIUtil
import skytils.skytilsmod.utils.Utils
import skytils.skytilsmod.utils.startsWithAny
@@ -131,7 +130,6 @@ class SkytilsLoadingPluginKt : IFMLLoadingPlugin {
SkytilsLoadingPlugin.exit()
}
}
- Config.startup()
}
override fun getASMTransformerClass(): Array<String> {