Search in sources :

Example 26 with CommentedFileConfig

use of com.electronwill.nightconfig.core.file.CommentedFileConfig in project Geolosys by oitsjustjose.

the class ClientConfig method loadConfig.

public static void loadConfig(ForgeConfigSpec spec, Path path) {
    final CommentedFileConfig configData = CommentedFileConfig.builder(path).sync().autosave().writingMode(WritingMode.REPLACE).build();
    configData.load();
    spec.setConfig(configData);
}
Also used : CommentedFileConfig(com.electronwill.nightconfig.core.file.CommentedFileConfig)

Example 27 with CommentedFileConfig

use of com.electronwill.nightconfig.core.file.CommentedFileConfig in project MC-Prefab by Brian-Wuest.

the class ModConfiguration method loadConfig.

public static void loadConfig(ForgeConfigSpec spec, Path path) {
    Prefab.LOGGER.debug("Loading config file {}", path);
    ModConfiguration.SPEC = spec;
    final CommentedFileConfig configData = CommentedFileConfig.builder(path).sync().autosave().writingMode(WritingMode.REPLACE).build();
    Prefab.LOGGER.info("Built TOML config for {}", path.toString());
    configData.load();
    Prefab.LOGGER.info("Loaded TOML config file {}", path.toString());
    spec.setConfig(configData);
    ModConfiguration.UpdateServerConfig();
}
Also used : CommentedFileConfig(com.electronwill.nightconfig.core.file.CommentedFileConfig)

Example 28 with CommentedFileConfig

use of com.electronwill.nightconfig.core.file.CommentedFileConfig in project PrimalMagick by daedalus4096.

the class Config method loadConfig.

protected static void loadConfig(ForgeConfigSpec spec, Path path) {
    final CommentedFileConfig configData = CommentedFileConfig.builder(path).sync().autosave().writingMode(WritingMode.REPLACE).build();
    configData.load();
    spec.setConfig(configData);
}
Also used : CommentedFileConfig(com.electronwill.nightconfig.core.file.CommentedFileConfig)

Example 29 with CommentedFileConfig

use of com.electronwill.nightconfig.core.file.CommentedFileConfig in project Growthcraft-1.16 by GrowthcraftCE.

the class GrowthcraftConfig method loadConfig.

public static void loadConfig(ForgeConfigSpec configSpec, String path) {
    final CommentedFileConfig fileConfig = CommentedFileConfig.builder(new File(path)).sync().autosave().writingMode(WritingMode.REPLACE).build();
    fileConfig.load();
    configSpec.setConfig(fileConfig);
}
Also used : CommentedFileConfig(com.electronwill.nightconfig.core.file.CommentedFileConfig) File(java.io.File)

Example 30 with CommentedFileConfig

use of com.electronwill.nightconfig.core.file.CommentedFileConfig in project Growthcraft-1.16 by GrowthcraftCE.

the class GrowthcraftApiaryConfig method loadConfig.

public static void loadConfig(ForgeConfigSpec configSpec, String path) {
    final CommentedFileConfig fileConfig = CommentedFileConfig.builder(new File(path)).sync().autosave().writingMode(WritingMode.REPLACE).build();
    fileConfig.load();
    configSpec.setConfig(fileConfig);
}
Also used : CommentedFileConfig(com.electronwill.nightconfig.core.file.CommentedFileConfig) File(java.io.File)

Aggregations

CommentedFileConfig (com.electronwill.nightconfig.core.file.CommentedFileConfig)45 File (java.io.File)12 Path (java.nio.file.Path)2 CommentedConfig (com.electronwill.nightconfig.core.CommentedConfig)1 ObjectConverter (com.electronwill.nightconfig.core.conversion.ObjectConverter)1 WritingMode (com.electronwill.nightconfig.core.io.WritingMode)1 Stopwatch (com.google.common.base.Stopwatch)1 Lists (com.google.common.collect.Lists)1 IOException (java.io.IOException)1 Field (java.lang.reflect.Field)1 Files (java.nio.file.Files)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Locale (java.util.Locale)1 TimeUnit (java.util.concurrent.TimeUnit)1 ForgeConfigSpec (net.minecraftforge.common.ForgeConfigSpec)1 Assert (org.junit.Assert)1 Test (org.junit.Test)1