mirror of
https://github.com/GTNewHorizons/GTNHLib.git
synced 2026-11-27 23:33:03 +00:00
don't merge configs in different subfolders (#59)
This commit is contained in:
1 file changed
+6
-4
@@ -59,7 +59,7 @@ public class ConfigurationManager {
|
||||
val modid = cfg.modid();
|
||||
val filename = Optional.of(cfg.filename().trim()).filter(s -> !s.isEmpty()).orElse(modid);
|
||||
|
||||
Configuration rawConfig = configs.computeIfAbsent(modid + "|" + filename, (ignored) -> {
|
||||
Configuration rawConfig = configs.computeIfAbsent(getConfigKey(cfg), (ignored) -> {
|
||||
Path newConfigDir = configDir;
|
||||
if (!cfg.configSubDirectory().trim().isEmpty()) {
|
||||
newConfigDir = newConfigDir.resolve(cfg.configSubDirectory().trim());
|
||||
@@ -231,9 +231,7 @@ public class ConfigurationManager {
|
||||
init();
|
||||
val cfg = Optional.ofNullable(configClass.getAnnotation(Config.class)).orElseThrow(
|
||||
() -> new ConfigException("Class " + configClass.getName() + " does not have a @Config annotation!"));
|
||||
val modid = cfg.modid();
|
||||
val filename = Optional.of(cfg.filename().trim()).filter(s -> !s.isEmpty()).orElse(modid);
|
||||
val rawConfig = Optional.ofNullable(configs.get(modid + "|" + filename)).map(
|
||||
val rawConfig = Optional.ofNullable(configs.get(getConfigKey(cfg))).map(
|
||||
(conf) -> Optional.ofNullable(configToCategoryClassMap.get(conf))
|
||||
.map((map) -> map.get(cfg.category().trim()).contains(configClass)).orElse(false) ? conf : null)
|
||||
.orElseThrow(
|
||||
@@ -267,6 +265,10 @@ public class ConfigurationManager {
|
||||
}
|
||||
}
|
||||
|
||||
private static String getConfigKey(Config cfg) {
|
||||
return cfg.modid() + "|" + cfg.configSubDirectory() + "|" + cfg.filename();
|
||||
}
|
||||
|
||||
private static File minecraftHome() {
|
||||
return Launch.minecraftHome != null ? Launch.minecraftHome : new File(".");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user