Lightman's Currency

Lightman's Currency

2M Downloads

Feature Request: Use currect file ending for config files

johalun opened this issue ยท 5 comments

commented

Lightman's Currency Version

1.20.1-2.2.4

Is your feature request related to a problem?

The config files are toml, but uses a custom file ending that is not recognized by an OS or any editor.

Describe the solution you'd like

If you're using toml files, please name the config files *.toml, not *.lcconfig. Having a custom file ending only causes extra work for other people having to map your custom file ending to toml syntax in their OS and their editors in order to get correct syntax highlighting and to get the files opened in the correct app.

Describe alternatives you've considered

N/A

Additional context

If you make this change, make sure that your mod renames existing .lcconfig files to .toml so people with custom configs don't get their custom configs reset without knowing. Otherwise, something to consider for the next project.

This is my only issue, otherwise thank you for this awesome mod.

commented

The config files be visually similar to toml, and they were designed to appear that way so that they'd be in a format that is familiar to any user that's worked with minecraft config files before, but I can promise you that the way they're read & written does not follow toml's rules/standards. Because of that I cannot reasonably change the file extension to *.toml without getting a lot of issue reports about why certain input formatting allowed in toml aren't being parsed and/or processed as they're supposed to.

commented

I see, thanks for clarifying. Just out of curiosity,

I can promise you that the way they're read & written does not follow toml's rules/standards

Is this a Minecraft/Forge thing, or is it up to each mod how to structure and parse their config files?

commented

Looking at my instance's config folder I see mostly .toml files, and some .json which why I assumed it's toml. Feels unnecessary though to introduce a unique file format when there are two prevalent options already used by most, especially when it's "almost" same as one of them. I'm not super familiar with modding but general good software engineering practice would be to use any of the already existing standards instead of re-inventing the wheel. Just as tip for future projects.

commented

While I do agree that it was a bit overkill to "re-invent" the wheel for my config files I was having several issues with the available options that were causing a load of complaints (the built-in forge toml configs often auto-reload while the server host is still uploading the edited file, resulting in a complete config wipe back to default values).

Combine that with the fact that I already have several json configs (the MasterCoinList.json file in particular), having full control over the load order of the various config files and whether they load before or after mine was a very helpful utility to make sure everything works as intended. I also didn't want to just use *.json for the more "normal" config files as they're very prone to user error (a single missing comma will make the entire json file unable to be parsed, and trust me I've gotten more than enough requests for help to realize that no matter how well I log the error people still aren't gonna read the server logs and debug their own issues), and it's not really possible to set up comments in json files without adding a third party library to use json5 or whatever, and I want to keep LC as a fully stand-alone mod.

Therefore making my own config system was the most reasonable choice that I could see from the options I had available, as it not only solved the aforementioned issues, it also allowed me to have full control over when each config was loaded (with the common config being loaded during the setup phase as that's when the villager trade offers are registered via event), as well as ensuring that certain json files were loaded before the normal configs are, as I need to ensure the MasterCoinList is loaded before I attempt to parse any money value config inputs from the server config, (with the added benefit of ensuring that manually reloading the MasterCoinList via command will also reload said money value config inputs as they're tied to the same reload command).

That said, if it being a custom file extension is truly that much of an issue, it might be a safe middle-ground for me to change the file extensions on those configs from *.lcconfig to a more reasonable *.txt. This should help alleviate any confusion in regards to what they should be editing the file with, without committing to obeying any rules in regards to any particular file type.

commented

As of v2.2.4.3, all normal config files now use the *.txt file extension so there should be no issues getting your server host and/or operating system to open them. All old *.lcconfig files will still be read if the *.txt version is not present, and they will be deleted the next time the config is successfully written to file (which happens right after the file is first loaded)