forked from virt-mirrors/Sit
fix modmenu data entry not removing bad data
This commit is contained in:
parent
817a6333cf
commit
5fff3687c7
1 changed files with 8 additions and 1 deletions
|
@ -13,17 +13,24 @@ import net.minecraft.util.Formatting;
|
||||||
import one.oth3r.sit.file.Config;
|
import one.oth3r.sit.file.Config;
|
||||||
|
|
||||||
public class ModMenu implements ModMenuApi {
|
public class ModMenu implements ModMenuApi {
|
||||||
|
|
||||||
private static MutableText lang(String key) {
|
private static MutableText lang(String key) {
|
||||||
return Text.translatable("config.sit."+key);
|
return Text.translatable("config.sit."+key);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MutableText lang(String key, Object... args) {
|
private static MutableText lang(String key, Object... args) {
|
||||||
return Text.translatable("config.sit."+key,args);
|
return Text.translatable("config.sit."+key,args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
||||||
// return null if YACL isn't installed to not throw an error
|
// return null if YACL isn't installed to not throw an error
|
||||||
if (!yaclCheck()) return screen -> null;
|
if (!yaclCheck()) return screen -> null;
|
||||||
return parent -> YetAnotherConfigLib.createBuilder().save(Config::save)
|
return parent -> YetAnotherConfigLib.createBuilder().save(() -> {
|
||||||
|
// save and load to get rid of bad data
|
||||||
|
Config.save();
|
||||||
|
Config.load();
|
||||||
|
})
|
||||||
.title(Text.of("Sit!"))
|
.title(Text.of("Sit!"))
|
||||||
.category(ConfigCategory.createBuilder()
|
.category(ConfigCategory.createBuilder()
|
||||||
.name(lang("category.general"))
|
.name(lang("category.general"))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue