From 0d6fe878d97ada2dad69146fc456732f4fc6c354 Mon Sep 17 00:00:00 2001 From: Unbistrackted <112902220+Unbistrackted@users.noreply.github.com> Date: Mon, 23 Feb 2026 08:27:59 -0300 Subject: [PATCH] chore(round): Change ``Round.IgnoredPlayers`` to use Player --- EXILED/Exiled.API/Features/Npc.cs | 4 ++-- EXILED/Exiled.API/Features/Round.cs | 2 +- EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs | 5 +++-- EXILED/Exiled.Events/Patches/Generic/LastTarget.cs | 7 ++++--- EXILED/Exiled.Events/Patches/Generic/RoundTargetCount.cs | 5 +++-- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/EXILED/Exiled.API/Features/Npc.cs b/EXILED/Exiled.API/Features/Npc.cs index 7791218042..893feac92c 100644 --- a/EXILED/Exiled.API/Features/Npc.cs +++ b/EXILED/Exiled.API/Features/Npc.cs @@ -291,7 +291,7 @@ public static Npc Spawn(string name, RoleTypeId role = RoleTypeId.None, bool ign }); if (ignored) - Round.IgnoredPlayers.Add(npc.ReferenceHub); + Round.IgnoredPlayers.Add(npc); Dictionary.Add(npc.GameObject, npc); return npc; @@ -334,7 +334,7 @@ public void Destroy() { try { - Round.IgnoredPlayers.Remove(ReferenceHub); + Round.IgnoredPlayers.Remove(this); Dictionary.Remove(ReferenceHub.gameObject); NetworkServer.Destroy(ReferenceHub.gameObject); } diff --git a/EXILED/Exiled.API/Features/Round.cs b/EXILED/Exiled.API/Features/Round.cs index 38bb4407ed..02a3407b5a 100644 --- a/EXILED/Exiled.API/Features/Round.cs +++ b/EXILED/Exiled.API/Features/Round.cs @@ -26,7 +26,7 @@ public static class Round /// /// Gets a list of players who will be ignored from determining round end. /// - public static HashSet IgnoredPlayers { get; } = new(20); // TODO: Replace ReferenceHub to Player remind to change RoundEnd transpiler + public static HashSet IgnoredPlayers { get; } = new(20); /// /// Gets the time elapsed from the start of the round. diff --git a/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs b/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs index fba037de79..e701deccb1 100644 --- a/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs +++ b/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs @@ -59,7 +59,7 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable), nameof(HashSet.Contains))), + new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), + new(OpCodes.Callvirt, Method(typeof(HashSet), nameof(HashSet.Contains))), new(OpCodes.Brtrue_S, jmp), }); diff --git a/EXILED/Exiled.Events/Patches/Generic/LastTarget.cs b/EXILED/Exiled.Events/Patches/Generic/LastTarget.cs index 442a5fbd63..c451459445 100644 --- a/EXILED/Exiled.Events/Patches/Generic/LastTarget.cs +++ b/EXILED/Exiled.Events/Patches/Generic/LastTarget.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -35,10 +35,11 @@ private static IEnumerable Transpiler(IEnumerable), nameof(HashSet.Contains))), + new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), + new(OpCodes.Callvirt, Method(typeof(HashSet), nameof(HashSet.Contains))), new(OpCodes.Brtrue_S, continueLabel), }); diff --git a/EXILED/Exiled.Events/Patches/Generic/RoundTargetCount.cs b/EXILED/Exiled.Events/Patches/Generic/RoundTargetCount.cs index a4d67081e9..983cb201af 100644 --- a/EXILED/Exiled.Events/Patches/Generic/RoundTargetCount.cs +++ b/EXILED/Exiled.Events/Patches/Generic/RoundTargetCount.cs @@ -52,11 +52,12 @@ private static IEnumerable Transpiler(IEnumerable), nameof(HashSet.Contains))), + new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), + new(OpCodes.Callvirt, Method(typeof(HashSet), nameof(HashSet.Contains))), new(OpCodes.Brfalse_S, skip), new(OpCodes.Ldc_I4_0),