Fixed config system only working with dh

This commit is contained in:
coolGi
2023-08-24 22:56:19 +09:30
parent d553965f28
commit f1b31a4cfe
3 changed files with 1 additions and 14 deletions
@@ -60,14 +60,6 @@ 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 (!Config.loaded)
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)
{
return;
}
@@ -1,7 +1,6 @@
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;
@@ -261,10 +260,6 @@ 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;
}