From 8e9b2c3f907b5b6ead95a0dde14f306cb8d98a42 Mon Sep 17 00:00:00 2001
From: MSWS <imodmaker@gmail.com>
Date: Fri, 1 Nov 2024 16:25:31 -0700
Subject: [PATCH] More work

---
 mod/Jailbreak.LastGuard/LastGuard.cs          |  2 +-
 mod/Jailbreak.Warden/Global/WardenBehavior.cs | 12 ++----------
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/mod/Jailbreak.LastGuard/LastGuard.cs b/mod/Jailbreak.LastGuard/LastGuard.cs
index 37ba6f34..af6772c7 100644
--- a/mod/Jailbreak.LastGuard/LastGuard.cs
+++ b/mod/Jailbreak.LastGuard/LastGuard.cs
@@ -163,7 +163,7 @@ public HookResult OnPlayerDeathEvent(EventPlayerDeath @event,
     var player = @event.Userid;
     if (player == null) return HookResult.Continue;
 
-    Server.NextFrame(() => checkLastGuard(@event.Userid));
+    checkLastGuard(@event.Userid);
 
     if (!IsLastGuardActive) return HookResult.Continue;
 
diff --git a/mod/Jailbreak.Warden/Global/WardenBehavior.cs b/mod/Jailbreak.Warden/Global/WardenBehavior.cs
index 75a6167e..2dddd5ec 100644
--- a/mod/Jailbreak.Warden/Global/WardenBehavior.cs
+++ b/mod/Jailbreak.Warden/Global/WardenBehavior.cs
@@ -245,7 +245,7 @@ public bool TryRemoveWarden(bool isPass = false) {
 
       logs.Append(logs.Player(Warden), "is no longer the warden.");
 
-      if (!isPass && false) {
+      if (!isPass) {
         var stats = API.Gangs?.Services.GetService<IPlayerStatManager>();
         if (stats != null) {
           var wrapper = new PlayerWrapper(Warden);
@@ -296,29 +296,21 @@ private async Task updateWardenDeathStats(PlayerWrapper player) {
 
   [GameEventHandler]
   public HookResult OnDeath(EventPlayerDeath ev, GameEventInfo info) {
-    return HookResult.Continue;
     var player = ev.Userid;
     if (player == null || !player.IsValid) return HookResult.Continue;
     var isWarden = ((IWardenService)this).IsWarden(player);
-    if (API.Gangs != null && false) {
-      Server.PrintToConsole("WardenBehavior: OnDeath");
+    if (API.Gangs != null) {
       if (ev.Attacker != null && ev.Attacker.IsValid && ev.Attacker != player
         && isWarden) {
-        Server.PrintToConsole("WardenBehavior: OnDeath: Attacker is valid");
         var wrapper = new PlayerWrapper(ev.Attacker);
         Task.Run(async () => await incrementWardenKills(wrapper));
       }
 
-      Server.PrintToConsole(
-        "WardenBehavior: OnDeath: Updating guard death stats");
       foreach (var guard in PlayerUtil.FromTeam(CsTeam.CounterTerrorist)) {
-        Server.PrintToConsole($"WardenBehavior: OnDeath: Guard: {guard}");
         var wrapper = new PlayerWrapper(guard);
         // If the guard is the warden, update all guards' stats
         // If the guard is not the warden, only update the warden's stats
         if (guard.SteamID == player.SteamID != isWarden) continue;
-        Server.PrintToConsole(
-          $"WardenBehavior: OnDeath: Guard: {guard} is the warden");
         Task.Run(async () => await updateGuardDeathStats(wrapper, isWarden));
       }
     }