From a4ca1c86ec8309097a548148ffbe7cde674ee095 Mon Sep 17 00:00:00 2001 From: ivan tkachenko Date: Fri, 19 Dec 2025 23:40:46 +0200 Subject: [PATCH] Save Harmony own instance in private static That's how other mods do it. Might be useful to reload patches. --- MuzikaGromche/Plugin.cs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/MuzikaGromche/Plugin.cs b/MuzikaGromche/Plugin.cs index 7656b90..3bd6b01 100644 --- a/MuzikaGromche/Plugin.cs +++ b/MuzikaGromche/Plugin.cs @@ -27,6 +27,7 @@ namespace MuzikaGromche [BepInDependency("BMX.LobbyCompatibility", BepInDependency.DependencyFlags.SoftDependency)] public class Plugin : BaseUnityPlugin { + private static Harmony Harmony = null!; internal static ManualLogSource Log = null!; internal new static Config Config { get; private set; } = null!; @@ -945,17 +946,17 @@ namespace MuzikaGromche Config = new Config(base.Config); DiscoBallManager.Load(); PoweredLightsAnimators.Load(); - var harmony = new Harmony(PluginInfo.PLUGIN_NAME); - harmony.PatchAll(typeof(GameNetworkManagerPatch)); - harmony.PatchAll(typeof(JesterPatch)); - harmony.PatchAll(typeof(EnemyAIPatch)); - harmony.PatchAll(typeof(PoweredLightsAnimatorsPatch)); - harmony.PatchAll(typeof(AllPoweredLightsPatch)); - harmony.PatchAll(typeof(DiscoBallTilePatch)); - harmony.PatchAll(typeof(DiscoBallDespawnPatch)); - harmony.PatchAll(typeof(SpawnRatePatch)); - harmony.PatchAll(typeof(DeathScreenGameOverTextResetPatch)); - harmony.PatchAll(typeof(ScreenFiltersManager.HUDManagerScreenFiltersPatch)); + Harmony = new Harmony(PluginInfo.PLUGIN_NAME); + Harmony.PatchAll(typeof(GameNetworkManagerPatch)); + Harmony.PatchAll(typeof(JesterPatch)); + Harmony.PatchAll(typeof(EnemyAIPatch)); + Harmony.PatchAll(typeof(PoweredLightsAnimatorsPatch)); + Harmony.PatchAll(typeof(AllPoweredLightsPatch)); + Harmony.PatchAll(typeof(DiscoBallTilePatch)); + Harmony.PatchAll(typeof(DiscoBallDespawnPatch)); + Harmony.PatchAll(typeof(SpawnRatePatch)); + Harmony.PatchAll(typeof(DeathScreenGameOverTextResetPatch)); + Harmony.PatchAll(typeof(ScreenFiltersManager.HUDManagerScreenFiltersPatch)); NetcodePatcher(); Compatibility.Register(this); }