Skip to content

Commit

Permalink
1.4.1 | Fix OnDisabled Error
Browse files Browse the repository at this point in the history
  • Loading branch information
Vretu-Dev authored Sep 29, 2024
1 parent 1997340 commit beda7f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
14 changes: 4 additions & 10 deletions UsefulHints/EventHandlers/Modules/JailbirdPatchHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,13 @@ public static class JailbirdPatchHandler
public static string HarmonyName { get; private set; }
public static void RegisterEvents()
{
if (UsefulHints.Instance.Config.EnableCustomJailbirdSettings)
{
HarmonyName = $"com-vretu.uh-{DateTime.UtcNow.Ticks}";
Harmony = new Harmony(HarmonyName);
Harmony.PatchAll();
}
HarmonyName = $"com-vretu.uh-{DateTime.UtcNow.Ticks}";
Harmony = new Harmony(HarmonyName);
Harmony.PatchAll();
}
public static void UnregisterEvents()
{
if (UsefulHints.Instance.Config.EnableCustomJailbirdSettings)
{
Harmony.UnpatchAll(HarmonyName);
}
Harmony.UnpatchAll(HarmonyName);
}
}
}
6 changes: 3 additions & 3 deletions UsefulHints/UsefulHints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ public class UsefulHints : Plugin<Config>
public override string Name => "Useful Hints";
public override string Author => "Vretu";
public override string Prefix { get; } = "UH";
public override Version Version => new Version(1, 4, 0);
public override Version Version => new Version(1, 4, 1);
public override Version RequiredExiledVersion { get; } = new Version(8, 9, 8);
public static UsefulHints Instance { get; private set; }
public override void OnEnabled()
{
Instance = this;
if(Config.EnableHints){ EventHandlers.Entities.SCP096.RegisterEvents(); }
if(Config.EnableHints){ EventHandlers.Items.Hints.RegisterEvents(); }
EventHandlers.Modules.JailbirdPatchHandler.RegisterEvents();
if(Config.EnableCustomJailbirdSettings){ EventHandlers.Modules.JailbirdPatchHandler.RegisterEvents(); }
EventHandlers.Modules.KillCounter.RegisterEvents();
EventHandlers.Modules.LastHumanBroadcast.RegisterEvents();
EventHandlers.Modules.RoundSummary.RegisterEvents();
Expand All @@ -28,7 +28,7 @@ public override void OnDisabled()
Instance = null;
if(Config.EnableHints){ EventHandlers.Entities.SCP096.UnregisterEvents(); }
if(Config.EnableHints){ EventHandlers.Items.Hints.UnregisterEvents(); }
EventHandlers.Modules.JailbirdPatchHandler.UnregisterEvents();
if(Config.EnableCustomJailbirdSettings) { EventHandlers.Modules.JailbirdPatchHandler.UnregisterEvents(); }
EventHandlers.Modules.KillCounter.UnregisterEvents();
EventHandlers.Modules.LastHumanBroadcast.UnregisterEvents();
EventHandlers.Modules.RoundSummary.UnregisterEvents();
Expand Down

0 comments on commit beda7f0

Please sign in to comment.