use of com.electronwill.nightconfig.core.file.CommentedFileConfig in project tetra by mickelus.
the class ConfigHandler method setup.
public static void setup() {
// this is slightly more complicated than just calling ModLoadingContext.registerConfig but it allows us to preserve insertion order
// which makes the config easier to read
final CommentedFileConfig configData = CommentedFileConfig.builder(FMLPaths.CONFIGDIR.get().resolve("tetra.toml")).sync().autosave().preserveInsertionOrder().writingMode(WritingMode.REPLACE).build();
configData.load();
spec.setConfig(configData);
}
use of com.electronwill.nightconfig.core.file.CommentedFileConfig in project ServerTabInfo by Crimix.
the class Config 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);
}
use of com.electronwill.nightconfig.core.file.CommentedFileConfig in project Magma-1.16.x by magmafoundation.
the class ConfigTracker method openConfig.
private void openConfig(final ModConfig config, final Path configBasePath) {
LOGGER.trace(CONFIG, "Loading config file type {} at {} for {}", config.getType(), config.getFileName(), config.getModId());
final CommentedFileConfig configData = config.getHandler().reader(configBasePath).apply(config);
config.setConfigData(configData);
config.fireEvent(new ModConfig.Loading(config));
config.save();
}
use of com.electronwill.nightconfig.core.file.CommentedFileConfig in project Cyclic by Lothrazar.
the class ConfigRegistry method setupClient.
public static void setupClient() {
final CommentedFileConfig configData = CommentedFileConfig.builder(FMLPaths.CONFIGDIR.get().resolve(ModCyclic.MODID + "-client.toml")).sync().autosave().writingMode(WritingMode.REPLACE).build();
configData.load();
CLIENT_CONFIG.setConfig(configData);
}
use of com.electronwill.nightconfig.core.file.CommentedFileConfig in project LoliServer by Loli-Server.
the class ConfigTracker method openConfig.
private void openConfig(final ModConfig config, final Path configBasePath) {
LOGGER.trace(CONFIG, "Loading config file type {} at {} for {}", config.getType(), config.getFileName(), config.getModId());
final CommentedFileConfig configData = config.getHandler().reader(configBasePath).apply(config);
config.setConfigData(configData);
config.fireEvent(new ModConfig.Loading(config));
config.save();
}
Aggregations