fix: defer saving config

This commit is contained in:
Anna
2022-02-04 23:31:36 -05:00
parent 0699f5129f
commit 2018d73519
2 changed files with 10 additions and 5 deletions
+7 -4
View File
@@ -52,9 +52,6 @@ public sealed class Plugin : IDalamudPlugin {
[PluginService]
internal PartyList PartyList { get; init; }
[PluginService]
internal SigScanner SigScanner { get; init; }
[PluginService]
internal TargetManager TargetManager { get; init; }
@@ -65,11 +62,13 @@ public sealed class Plugin : IDalamudPlugin {
internal Store Store { get; }
internal PluginUi Ui { get; }
internal int DeferredSaveFrames = -1;
#pragma warning disable CS8618
public Plugin() {
LanguageChanged(this.Interface!.UiLanguage);
this.Config = this.Interface!.GetPluginConfig() as Configuration ?? new Configuration();
this.Config = this.Interface.GetPluginConfig() as Configuration ?? new Configuration();
this.Config.Migrate();
this.Common = new XivCommonBase();
this.TextureCache = new TextureCache(this.DataManager!);
@@ -111,6 +110,10 @@ public sealed class Plugin : IDalamudPlugin {
};
private void FrameworkUpdate(Framework framework) {
if (this.DeferredSaveFrames >= 0 && this.DeferredSaveFrames-- == 0) {
this.SaveConfig();
}
if (!this.Config.HideChat) {
return;
}