From 1d1a38d130eb0b79349d053d03aaa43af1312586 Mon Sep 17 00:00:00 2001
From: MSWS <imodmaker@gmail.com>
Date: Wed, 28 Aug 2024 18:18:51 -0700
Subject: [PATCH] Fix HNS pickups

---
 mod/Jailbreak.SpecialDay/SpecialDays/HideAndSeekDay.cs | 4 ++--
 mod/Jailbreak.SpecialDay/SpecialDays/SpeedrunDay.cs    | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/mod/Jailbreak.SpecialDay/SpecialDays/HideAndSeekDay.cs b/mod/Jailbreak.SpecialDay/SpecialDays/HideAndSeekDay.cs
index df7887a7..627e66ad 100644
--- a/mod/Jailbreak.SpecialDay/SpecialDays/HideAndSeekDay.cs
+++ b/mod/Jailbreak.SpecialDay/SpecialDays/HideAndSeekDay.cs
@@ -166,8 +166,8 @@ public HnsSettings() {
       cachedGuardWeapons    = CV_GUARD_WEAPONS.Value.Split(",").ToHashSet();
       cachedPrisonerWeapons = CV_PRISONER_WEAPONS.Value.Split(",").ToHashSet();
 
-      if (cachedGuardWeapons.Count == 0) cachedGuardWeapons       = null;
-      if (cachedPrisonerWeapons.Count == 0) cachedPrisonerWeapons = null;
+      if (CV_GUARD_WEAPONS.Value.Length == 0) cachedGuardWeapons       = null;
+      if (CV_PRISONER_WEAPONS.Value.Length == 0) cachedPrisonerWeapons = null;
     }
 
     public override int InitialHealth(CCSPlayerController player) {
diff --git a/mod/Jailbreak.SpecialDay/SpecialDays/SpeedrunDay.cs b/mod/Jailbreak.SpecialDay/SpecialDays/SpeedrunDay.cs
index 799a14b3..2e0a0c4d 100644
--- a/mod/Jailbreak.SpecialDay/SpecialDays/SpeedrunDay.cs
+++ b/mod/Jailbreak.SpecialDay/SpecialDays/SpeedrunDay.cs
@@ -695,6 +695,8 @@ private void endRound() {
 
       if (CV_WINNER_DAMAGEABLE.Value) EnableDamage(winner);
 
+      Plugin.DeregisterEventHandler<EventItemPickup>(OnPickup);
+      
       foreach (var weapon in CV_LOSERS_WEAPONS.Value.Split(','))
         foreach (var loser in losers)
           loser.GiveNamedItem(weapon);
@@ -703,7 +705,6 @@ private void endRound() {
         winner.GiveNamedItem(weapon);
 
       Plugin.RemoveListener<Listeners.OnTick>(checkFinishers);
-      Plugin.DeregisterEventHandler<EventItemPickup>(OnPickup);
       RoundUtil.SetTimeRemaining(Math.Min(timeToSet, CV_WIN_TIME_MAX.Value));
       Server.ExecuteCommand("mp_ignore_round_win_conditions 0");
       return;