Revert "Fixed config system only working with dh"

This reverts commit f1b31a4cfe.
This commit is contained in:
James Seibel
2023-08-24 21:16:13 -05:00
parent e62ddc302b
commit 1fba04132b
3 changed files with 14 additions and 1 deletions
@@ -60,6 +60,14 @@ public class Config
public static ConfigCategory client = new ConfigCategory.Builder().set(Client.class).build();
/**
* <strong>False</strong> if the config hasn't been loaded in from file yet.
* While in this state the config shouldn't be modified since it may cause file corruption. <br><br>
*
* <strong>True</strong> if the config has been loaded and is ready to use.
*/
public static boolean loaded = false;
public static class Client
@@ -64,7 +64,7 @@ public abstract class AbstractPresetConfigEventHandler<TPresetEnum extends Enum<
public void onConfigValueSet()
{
// don't try modifying the config before it's been loaded from file
if (this.configList.get(0).configEntry.configBase == null) // If the config is not initialised, then this should not be ran (so it checks the first config item)
if (!Config.loaded)
{
return;
}
@@ -1,6 +1,7 @@
package com.seibel.distanthorizons.core.config.file;
import com.electronwill.nightconfig.core.file.CommentedFileConfig;
import com.seibel.distanthorizons.core.config.Config;
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
import com.seibel.distanthorizons.core.config.ConfigBase;
import com.seibel.distanthorizons.core.config.types.AbstractConfigType;
@@ -260,6 +261,10 @@ public class ConfigFileHandling
SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class).crashMinecraft("Loading file and resetting config file failed at path [" + configPath + "]. Please check the file is ok and you have the permissions", ex);
}
}
// if the config is modified before having been loaded it can cause file corruption
// and permissions errors
Config.loaded = true;
}