Torchmaster

Torchmaster

64M Downloads

Invalid configuration setup causes config load failure

Linguardium opened this issue ยท 2 comments

commented

.define("megaTorchEntityBlockListOverrides", new ArrayList<>(), o -> o instanceof String);
dreadLampEntityBlockListOverrides = builder
.comment(
"Same as the mega torch block list override, just for the dread lamp",
"Block squid: +minecraft:squid",
"Allow pigs: -minecraft:pig")
.translation("torchmaster.config.dreadLamp.blockListOverrides.description")
.define("dreadLampEntityBlockListOverrides", new ArrayList<>(), o -> o instanceof String);

i believe these should be using the defineListAllowEmpty rather than the define

Alternatively, your validator should validate the actual config value ( a list) rather than the element values

commented

Sorry for the delay, I had some issues understanding what you actually want to get at.
I guess you mean the game crashes when you assign a string to the list rather than a list of strings? Yeah, that was something I didn't test. The config code is quite old, and I'm not sure when they introduced the list defines.

I've switched to defineListAllowEmpty and I'm providing a validator for each entry. I've also updated the comments to give a bit more details on how the syntax works in toml. I'll release these changes when I port some features from 1.20 to 1.21

Thanks for reporting the issue

commented

Actually the issue was that the default value would never pass the validation. An ArrayList is never an instanceof String.
So every launch would recreate the config and backup the existing for no reason.

Glad you got it fixed though