Skip to content

Commit

Permalink
This was actually needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Caedis committed Feb 27, 2024
1 parent 601e3d7 commit df2c9d8
Showing 1 changed file with 9 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,24 +214,15 @@ public static List<IConfigElement> getConfigElements(Class<?> configClass) throw
() -> new ConfigException("Tried to get config elements for non-registered config class!"));
val category = cfg.category();
val elements = new ConfigElement<>(rawConfig.getCategory(category)).getChildElements();
List<IConfigElement> processedElements = elements.stream()
.map((element) -> new IConfigElementProxy(element, () -> {
try {
processConfigInternal(configClass, category, rawConfig);
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException
| NoSuchFieldException | ConfigException e) {
e.printStackTrace();
}
})).collect(Collectors.toList());

// Save the configuration after all elements have been processed
try {
rawConfig.save();
} catch (Exception e) {
e.printStackTrace();
}

return processedElements;
return elements.stream().map((element) -> new IConfigElementProxy(element, () -> {
try {
processConfigInternal(configClass, category, rawConfig);
rawConfig.save();
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException | NoSuchFieldException
| ConfigException e) {
e.printStackTrace();
}
})).collect(Collectors.toList());
}

@SuppressWarnings({ "rawtypes" })
Expand Down

0 comments on commit df2c9d8

Please sign in to comment.