internal static void Save(ModConfig config)
        {
            Directory.CreateDirectory(ModConfigPath);
            string filename = config.mod.Name + "_" + config.Name + ".json";
            string path     = Path.Combine(ModConfigPath, filename);
            string json     = JsonConvert.SerializeObject(config, serializerSettings);

            File.WriteAllText(path, json);
            config.PostSave();
        }
        internal static void HandleInGameChangeConfigPacket(BinaryReader reader, int whoAmI)
        {
            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                bool   success = reader.ReadBoolean();
                string message = reader.ReadString();
                if (success)
                {
                    string    modname    = reader.ReadString();
                    string    configname = reader.ReadString();
                    string    json       = reader.ReadString();
                    ModConfig config     = GetConfig(ModLoader.GetMod(modname), configname);
                    JsonConvert.PopulateObject(json, config, serializerSettingsCompact);
                    config.PostSave();

                    Main.NewText($"Shared config changed: Message: {message}, Mod: {modname}, Config: {configname}");
                    if (Main.InGameUI.CurrentState == Interface.modConfig)
                    {
                        Main.InGameUI.SetState(Interface.modConfig);
                    }
                }
                else
                {
                    // rejection only sent back to requester.
                    // Update UI with message

                    Main.NewText("Changes Rejected: " + message);
                    if (Main.InGameUI.CurrentState == Interface.modConfig)
                    {
                        Interface.modConfig.SetMessage("Server rejected changes: " + message, Color.Red);
                        //Main.InGameUI.SetState(Interface.modConfig);
                    }
                }
            }
            else
            {
                // no bool in request.
                string    modname    = reader.ReadString();
                string    configname = reader.ReadString();
                string    json       = reader.ReadString();
                ModConfig config     = GetConfig(ModLoader.GetMod(modname), configname);
                ModConfig pending    = config.Clone();
                JsonConvert.PopulateObject(json, pending, serializerSettingsCompact);
                bool   success = true;
                string message = "Accepted";
                if (pending.NeedsReload(config))
                {
                    success = false;
                    message = "Can't save because changes would require a reload.";
                }
                if (!pending.AcceptClientChanges(config, whoAmI, ref message))
                {
                    success = false;
                }
                if (success)
                {
                    // Apply to Servers Config
                    JsonConvert.PopulateObject(json, config, ConfigManager.serializerSettingsCompact);
                    config.PostSave();
                    // Send new config to all clients
                    var p = new ModPacket(MessageID.InGameChangeConfig);
                    p.Write(true);
                    p.Write(message);
                    p.Write(modname);
                    p.Write(configname);
                    p.Write(json);
                    p.Send();
                }
                else
                {
                    // Send rejections message back to client who requested change
                    var p = new ModPacket(MessageID.InGameChangeConfig);
                    p.Write(false);
                    p.Write(message);
                    p.Send(whoAmI);
                }
            }
            return;
        }