diff --git a/QSB/QSBCore.cs b/QSB/QSBCore.cs index 361b566a..d816763f 100644 --- a/QSB/QSBCore.cs +++ b/QSB/QSBCore.cs @@ -58,7 +58,6 @@ public class QSBCore : ModBehaviour Application.version.Split('.').Take(3).Join(delimiter: "."); public static bool DLCInstalled => EntitlementsManager.IsDlcOwned() == EntitlementsManager.AsyncOwnershipStatus.Owned; public static bool IncompatibleModsAllowed { get; private set; } - public static bool ShowPlayerNames { get; private set; } public static GameVendor GameVendor { get; private set; } = GameVendor.None; public static bool IsStandalone => GameVendor is GameVendor.Epic or GameVendor.Steam; public static IProfileManager ProfileManager => IsStandalone @@ -245,14 +244,21 @@ public class QSBCore : ModBehaviour { DefaultServerIP = config.GetSettingsValue("defaultServerIP"); IncompatibleModsAllowed = config.GetSettingsValue("incompatibleModsAllowed"); - var _showPlayerNames = config.GetSettingsValue("showPlayerNames"); - - if (_showPlayerNames != ShowPlayerNames) + if (!IsInMultiplayer || IsHost) { - new ServerSettingsMessage().Send(); - } + var _showPlayerNames = config.GetSettingsValue("showPlayerNames"); - ShowPlayerNames = _showPlayerNames; + if (_showPlayerNames != ServerSettingsManager.ShowPlayerNames) + { + new ServerSettingsMessage().Send(); + } + + ServerSettingsManager.ShowPlayerNames = _showPlayerNames; + } + else + { + config.SetSettingsValue("showPlayerNames", ServerSettingsManager.ShowPlayerNames); + } } private void Update() diff --git a/QSB/ServerSettings/ServerSettingsMessage.cs b/QSB/ServerSettings/ServerSettingsMessage.cs index cecb6be4..e8983c2e 100644 --- a/QSB/ServerSettings/ServerSettingsMessage.cs +++ b/QSB/ServerSettings/ServerSettingsMessage.cs @@ -7,10 +7,15 @@ internal class ServerSettingsMessage : QSBMessage { private bool _showPlayerNames; + public ServerSettingsMessage() + { + _showPlayerNames = ServerSettingsManager.ShowPlayerNames; + } + public override void Serialize(NetworkWriter writer) { base.Serialize(writer); - writer.Write(QSBCore.ShowPlayerNames); + writer.Write(_showPlayerNames); } public override void Deserialize(NetworkReader reader)