Overwrite the config if any new fields are missing
This commit is contained in:
parent
be2040a740
commit
90f519a1c6
4 changed files with 72 additions and 18 deletions
|
|
@ -389,7 +389,7 @@ namespace TShockAPI.DB
|
|||
}
|
||||
|
||||
// Read the config file to prevent the possible loss of any unsaved changes
|
||||
TShock.Config = ConfigFile.Read(FileTools.ConfigPath);
|
||||
TShock.Config = ConfigFile.Read(FileTools.ConfigPath, out bool writeConfig);
|
||||
if (TShock.Config.DefaultGuestGroupName == oldGroup.Name)
|
||||
{
|
||||
TShock.Config.DefaultGuestGroupName = newGroup.Name;
|
||||
|
|
@ -399,7 +399,10 @@ namespace TShockAPI.DB
|
|||
{
|
||||
TShock.Config.DefaultRegistrationGroupName = newGroup.Name;
|
||||
}
|
||||
TShock.Config.Write(FileTools.ConfigPath);
|
||||
if (writeConfig)
|
||||
{
|
||||
TShock.Config.Write(FileTools.ConfigPath);
|
||||
}
|
||||
|
||||
// We also need to check if any users belong to the old group and automatically apply changes
|
||||
using (var command = db.CreateCommand())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue