private static void PlayerSpawnedInWorld(ClientInfo _cInfo, RespawnType _respawnReason, Vector3i _pos)//Spawning player { try { if (_cInfo != null && _cInfo.playerId != null) { if (CredentialCheck.IsEnabled && !CredentialCheck.AccCheck(_cInfo)) { SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} 1 years \"Auto detection has banned you for false credentials. Contact an admin if this is a mistake\"", _cInfo.playerId), null); return; } if (CountryBan.IsEnabled && CountryBan.IsCountryBanned(_cInfo)) { SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} 1 years \"Auto detection has banned you for country IP region\"", _cInfo.playerId), null); return; } PersistentContainer.Instance.Players[_cInfo.playerId].LastJoined = DateTime.Now; if (GameManager.Instance.World.Players.dict.ContainsKey(_cInfo.entityId)) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_player != null) { PersistentContainer.Instance.Players[_cInfo.playerId].PlayerName = _cInfo.playerName; PersistentOperations.SessionTime(_cInfo); if (_respawnReason == RespawnType.EnterMultiplayer)//New player spawning. Game bug can trigger this incorrectly { if (_player.distanceWalked < 1 && _player.totalTimePlayed <= 1) { Timers.NewPlayerTimer(_cInfo); } else { OldPlayerJoined(_cInfo, _player); } } else if (_respawnReason == RespawnType.JoinMultiplayer)//Old player spawning { if (_player.distanceWalked < 1 && _player.totalTimePlayed <= 10) { Timers.NewPlayerTimer(_cInfo); } else { OldPlayerJoined(_cInfo, _player); } } else if (_respawnReason == RespawnType.Died)//Player died, respawning { PlayerDied(_cInfo); } else if (_respawnReason == RespawnType.Teleport) { if (Teleportation.Teleporting.Contains(_cInfo.entityId)) { Teleportation.Teleporting.Remove(_cInfo.entityId); } } } if (ExitCommand.IsEnabled && !ExitCommand.Players.ContainsKey(_cInfo.entityId) && GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo) > ExitCommand.Admin_Level) { ExitCommand.Players.Add(_cInfo.entityId, _player.position); } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in API.PlayerSpawnedInWorld: {0}", e.Message)); } }