From f333f772a617d4a65f162b7aaa375b2c32eca6b0 Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Sun, 5 Apr 2020 03:56:30 -0500 Subject: [PATCH] Added an event for any time that plugins are disabled --- IPA.Loader/Loader/PluginManager.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/IPA.Loader/Loader/PluginManager.cs b/IPA.Loader/Loader/PluginManager.cs index 48d2ffc0..4bdf1629 100644 --- a/IPA.Loader/Loader/PluginManager.cs +++ b/IPA.Loader/Loader/PluginManager.cs @@ -158,7 +158,8 @@ namespace IPA.Loader } } - Task result; + var result = TaskEx.WhenAll(); + if (toDisable.Any()) { // then disable the mods that need to be static DisableExecutor MakeDisableExec(PluginExecutor e) @@ -208,6 +209,7 @@ namespace IPA.Loader var disabled = new Dictionary(); result = TaskEx.WhenAll(disableStructure.Select(d => Disable(d, disabled))); + OnPluginsDisabled?.Invoke(result); } //DisabledConfig.Instance.Changed(); @@ -258,6 +260,14 @@ namespace IPA.Loader /// Called whenever a plugin is disabled. /// public static event PluginDisableDelegate PluginDisabled; + /// + /// Called whenever any plugins are disabled with the representing them being disabled. + /// + /// + /// Note that this is called on the Unity main thread, and cannot therefore block, as the + /// provided represents operations that also run on the Unity main thread. + /// + public static event Action OnPluginsDisabled; /// /// Gets a list of all enabled BSIPA plugins. Use instead of this.