Fix error printed on server closing about failing to release/unload on forge 31.1.87 or higher
Note: No min version bump is required as the Override annotation does not cause problems, and the body (super.unload) does not get resolved without the method being called
@@ -36,13 +36,22 @@ public class MekanismModConfig extends ModConfig {
private static class MekanismConfigFileTypeHandler extends ConfigFileTypeHandler {
- @Override
- public Function<ModConfig, CommentedFileConfig> reader(Path configBasePath) {
+ private static Path getPath(Path configBasePath) {
//Intercept server config path reading for Mekanism configs and reroute it to the normal config directory
if (configBasePath.endsWith("serverconfig")) {
- return super.reader(FMLPaths.CONFIGDIR.get());
+ return FMLPaths.CONFIGDIR.get();
+ }
+ return configBasePath;
}
- return super.reader(configBasePath);
+
+ @Override
+ public Function<ModConfig, CommentedFileConfig> reader(Path configBasePath) {
+ return super.reader(getPath(configBasePath));
+ }
+
+ @Override
+ public void unload(Path configBasePath, ModConfig config) {
+ super.unload(getPath(configBasePath), config);
}
}
}
\ No newline at end of file
