From 5b6f1c1bbc75046752cffeec2b5734742a3bc5fc Mon Sep 17 00:00:00 2001 From: Vretu-Dev Date: Wed, 16 Oct 2024 19:28:01 +0200 Subject: [PATCH] 1.7.2 | Check activeItems before adding them for SCP-268 --- UsefulHints/EventHandlers/Items/Hints.cs | 8 ++++++-- UsefulHints/UsefulHints.cs | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/UsefulHints/EventHandlers/Items/Hints.cs b/UsefulHints/EventHandlers/Items/Hints.cs index a5cdfa2..bf83770 100644 --- a/UsefulHints/EventHandlers/Items/Hints.cs +++ b/UsefulHints/EventHandlers/Items/Hints.cs @@ -91,9 +91,9 @@ private static void OnSCP1576Used(UsedItemEventArgs ev) { if (ev.Item.Type == ItemType.SCP1576) { - if (activeCoroutines.TryGetValue(ev.Player, out var existingCoroutine)) + if (activeCoroutines.ContainsKey(ev.Player)) { - Timing.KillCoroutines(existingCoroutine); + Timing.KillCoroutines(activeCoroutines[ev.Player]); activeCoroutines.Remove(ev.Player); } if (activeItems.ContainsKey(ev.Player)) @@ -137,6 +137,10 @@ private static void OnSCP268Used(UsedItemEventArgs ev) Timing.KillCoroutines(activeCoroutines[ev.Player]); activeCoroutines.Remove(ev.Player); } + if (activeItems.ContainsKey(ev.Player)) + { + activeItems.Remove(ev.Player); + } var coroutine = Timing.RunCoroutine(Scp268Timer(ev.Player)); activeCoroutines.Add(ev.Player, coroutine); diff --git a/UsefulHints/UsefulHints.cs b/UsefulHints/UsefulHints.cs index 59555ab..6c5cb42 100644 --- a/UsefulHints/UsefulHints.cs +++ b/UsefulHints/UsefulHints.cs @@ -9,7 +9,7 @@ public class UsefulHints : Plugin public override string Name => "Useful Hints"; public override string Author => "Vretu"; public override string Prefix { get; } = "UH"; - public override Version Version => new Version(1, 7, 1); + public override Version Version => new Version(1, 7, 2); public override Version RequiredExiledVersion { get; } = new Version(8, 9, 8); public override PluginPriority Priority { get; } = PluginPriority.Low; public static UsefulHints Instance { get; private set; }