diff --git a/src/BAUPlugin.cs b/src/BAUPlugin.cs index 28e0c86..7dc3b12 100644 --- a/src/BAUPlugin.cs +++ b/src/BAUPlugin.cs @@ -1,4 +1,6 @@ -using BepInEx; +#pragma warning disable CS0162 + +using BepInEx; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BetterAmongUs.Attributes; @@ -93,12 +95,12 @@ internal class BAUPlugin : BasePlugin /// /// Gets the list of all alive PlayerControl instances. /// - internal static List AllAlivePlayerControls => AllPlayerControls.Where(pc => pc.IsAlive()).ToList(); + internal static List AllAlivePlayerControls => [.. AllPlayerControls.Where(pc => pc.IsAlive())]; /// /// Gets all DeadBody objects in the scene. /// - internal static DeadBody[] AllDeadBodys => UnityEngine.Object.FindObjectsOfType().ToArray(); + internal static DeadBody[] AllDeadBodys => [.. UnityEngine.Object.FindObjectsOfType()]; /// /// Gets all Vent objects in the scene. diff --git a/src/Modules/HandshakeHandler.cs b/src/Modules/HandshakeHandler.cs index 5f9d823..b52d3e3 100644 --- a/src/Modules/HandshakeHandler.cs +++ b/src/Modules/HandshakeHandler.cs @@ -154,11 +154,11 @@ internal sealed class HandshakeHandler if (!_pendingVerificationData.HasValue) return; if (SharedSecret.GetSharedSecret().Length == 0) return; - var data = _pendingVerificationData.Value; + var (tempKey, receivedHash) = _pendingVerificationData.Value; // Logger.Log($"Received hash check: TempKey={data.tempKey} (ours={SharedSecret.GetTempKey()}), Hash={data.receivedHash} (ours={SharedSecret.GetSharedSecretHash()})"); - if (data.tempKey != SharedSecret.GetTempKey()) + if (tempKey != SharedSecret.GetTempKey()) { // Logger.Warning($"Invalid tempKey from {extendedData._Data?.PlayerName}"); return; @@ -166,7 +166,7 @@ internal sealed class HandshakeHandler _extendedData.IsBetterUser = true; - if (data.receivedHash == SharedSecret.GetSharedSecretHash()) + if (receivedHash == SharedSecret.GetSharedSecretHash()) { _extendedData.IsVerifiedBetterUser = true; // Logger.Log($"Verified player: {extendedData._Data?.PlayerName}");