From 7b8f0fe57c76891a234d5b2c73a024b9adf24707 Mon Sep 17 00:00:00 2001 From: Xilophor Date: Tue, 27 Aug 2024 17:17:18 -0400 Subject: [PATCH] Fixed incorrect logic for LNetworkUtils.IsConnected --- CHANGELOG.md | 3 +++ LethalNetworkAPI/Utils/LNetworkUtils.cs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 729069f..4f07323 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +- Fixed `IsConnected` not working properly. + ## [v3.2.0] ### Changed diff --git a/LethalNetworkAPI/Utils/LNetworkUtils.cs b/LethalNetworkAPI/Utils/LNetworkUtils.cs index d4c51ca..d63c1d5 100644 --- a/LethalNetworkAPI/Utils/LNetworkUtils.cs +++ b/LethalNetworkAPI/Utils/LNetworkUtils.cs @@ -27,7 +27,7 @@ public static int GetPlayerId(ulong clientGuid) => /// /// Whether the client is connected to a server. /// - public static bool IsConnected => NetworkManager.Singleton != null; + public static bool IsConnected => NetworkManager.Singleton?.IsConnectedClient ?? false; /// /// Whether the client is the host or server.