From 6b011d8acd88fd85992dad6927e9faead3919d67 Mon Sep 17 00:00:00 2001 From: Mister_Nebula <41904486+misternebula@users.noreply.github.com> Date: Sun, 14 Aug 2022 20:38:34 +0100 Subject: [PATCH] check for players with the current transformsync --- QSB/Player/TransformSync/PlayerTransformSync.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/QSB/Player/TransformSync/PlayerTransformSync.cs b/QSB/Player/TransformSync/PlayerTransformSync.cs index 3e4a7e52..1e026b45 100644 --- a/QSB/Player/TransformSync/PlayerTransformSync.cs +++ b/QSB/Player/TransformSync/PlayerTransformSync.cs @@ -40,6 +40,14 @@ public class PlayerTransformSync : SectoredTransformSync } _hasRanOnStartClient = true; + if (QSBPlayerManager.PlayerList.Any(x => x.TransformSync == this)) + { + // this really shouldnt happen... + DebugLog.ToConsole($"Error - A PlayerInfo already exists with TransformSync {gameObject.name}", MessageType.Error); + Destroy(this); + return; + } + var player = new PlayerInfo(this); QSBPlayerManager.PlayerList.SafeAdd(player); base.OnStartClient();