
[suggestion] Backup config load instead of resetting the existing one
Closed this issue · 2 comments
Basically, when you reload the thing, and something is misformated in the config, it resets the whole thing.
Would there be a way to make it load it’s internal config WITHOUT resetting the user’s? So the user can fix the issue and reload the config again to test it?
Related ticket: #967
The main plugin config is mostly handled by the Bukkit API implementation itself (create if missing, reload when the plugin enables, save when changes have been made, etc.). I don't think I currently want to deviate from that too much, i.e. I don't want to use an additional config source loaded directly from the internal config file.
However, I can probably improve the handling of this situation by checking if the reloaded config is completely empty, and if it is, I treat this like any other config loading error and disable the plugin, just as it is already the case if I fail to subsequently load some particular setting from the loaded config data, or fail to apply some automatic migration, etc.
The only consequence will be that I cannot differentiate between the config being actually empty and the config failing to load, so defaults will not be inserted anymore if the config file is empty. Only if the file is fully deleted. But I think this is a minor issue.
This change will be included in the next plugin version.