diff --git a/HellionChat/Plugin.cs b/HellionChat/Plugin.cs index cf432fe..4168ce6 100755 --- a/HellionChat/Plugin.cs +++ b/HellionChat/Plugin.cs @@ -91,6 +91,13 @@ public sealed class Plugin : IAsyncDalamudPlugin public static Configuration Config = null!; public static FileDialogManager FileDialogManager { get; private set; } = null!; + // Single static handle to the live Plugin instance. Lets statically-accessed + // UI helpers (TabContextMenu) reach instance-only members — SaveConfig(), + // AutoTellTabsService, CustomAudioPlayer — without ctor-injection. A per-member + // static accessor is impossible: it would collide by name with the instance + // property (CS0102). Filled in the post-resolve bridge block below. + internal static Plugin Instance = null!; + public readonly WindowSystem WindowSystem = new(PluginName); // Phase-2 services are constructed in LoadAsync; null! shape is kept @@ -289,6 +296,10 @@ public sealed class Plugin : IAsyncDalamudPlugin ); _host = PluginHostFactory.Build(this, dependencies); + + // Bridge the static handle before the instance members below are read. + Instance = this; + _lifecycle = _host.Services.GetRequiredService(); _lifecycle.Host = _host;