void CompleteLoginProcess() { // Lock to ensure that no two players can end up with the same playerid lock (PlayerInfo.Online.locker) { id = NextFreeId(); PlayerInfo.Online.Add(this); } SendMap(null); if (disconnected) { return; } loggedIn = true; connections.Remove(this); RemoveFromPending(); Server.PlayerListUpdate(); SessionStartTime = DateTime.UtcNow; LastLogin = DateTime.Now; TotalTime = TimeSpan.FromSeconds(1); GetPlayerStats(); ShowWelcome(); Server.Background.QueueOnce(ShowAltsTask, name, TimeSpan.Zero); CheckState(); ZombieStats stats = Server.zombie.LoadZombieStats(name); Game.MaxInfected = stats.MaxInfected; Game.TotalInfected = stats.TotalInfected; Game.MaxRoundsSurvived = stats.MaxRounds; Game.TotalRoundsSurvived = stats.TotalRounds; if (!Directory.Exists("players")) { Directory.CreateDirectory("players"); } PlayerDB.Load(this); Game.Team = Team.TeamIn(this); SetPrefix(); LoadCpeData(); if (ServerConfig.verifyadmins && group.Permission >= ServerConfig.VerifyAdminsRank) { adminpen = true; } if (Server.noEmotes.Contains(name)) { parseEmotes = !ServerConfig.ParseEmotes; } LevelPermission adminChatRank = CommandExtraPerms.MinPerm("adminchat", LevelPermission.Admin); hidden = group.CanExecute("hide") && Server.hidden.Contains(name); if (hidden) { SendMessage("&8Reminder: You are still hidden."); } if (group.Permission >= adminChatRank && ServerConfig.AdminsJoinSilently) { hidden = true; adminchat = true; } OnPlayerConnectEvent.Call(this); if (cancellogin) { cancellogin = false; return; } string joinm = "&a+ " + FullName + " %S" + PlayerDB.GetLoginMessage(this); if (hidden) { joinm = "&8(hidden)" + joinm; } const LevelPermission perm = LevelPermission.Guest; if (group.Permission > perm || (ServerConfig.GuestJoinsNotify && group.Permission <= perm)) { Chat.MessageGlobal(this, joinm, false, true); } if (ServerConfig.AgreeToRulesOnEntry && group.Permission == LevelPermission.Guest && !Server.agreed.Contains(name)) { SendMessage("&9You must read the &c/Rules&9 and &c/Agree&9 to them before you can build and use commands!"); agreed = false; } if (ServerConfig.verifyadmins && group.Permission >= ServerConfig.VerifyAdminsRank) { if (!Directory.Exists("extra/passwords") || !File.Exists("extra/passwords/" + name + ".dat")) { SendMessage("&cPlease set your admin verification password with %T/SetPass [Password]!"); } else { SendMessage("&cPlease complete admin verification with %T/Pass [Password]!"); } } try { if (group.CanExecute("inbox") && Database.TableExists("Inbox" + name)) { using (DataTable table = Database.Backend.GetRows("Inbox" + name, "*")) { if (table.Rows.Count > 0) { SendMessage("You have &a" + table.Rows.Count + " %Smessages in %T/Inbox"); } } } } catch { } if (ServerConfig.PositionUpdateInterval > 1000) { SendMessage("Lowlag mode is currently &aON."); } if (String.IsNullOrEmpty(appName)) { Logger.Log(LogType.UserActivity, "{0} [{1}] connected.", name, ip); } else { Logger.Log(LogType.UserActivity, "{0} [{1}] connected using {2}.", name, ip, appName); } Game.InfectMessages = PlayerDB.GetInfectMessages(this); Server.lava.PlayerJoinedServer(this); Position pos = level.SpawnPos; byte yaw = level.rotx, pitch = level.roty; OnPlayerSpawningEvent.Call(this, ref pos, ref yaw, ref pitch, false); Pos = pos; SetYawPitch(yaw, pitch); Entities.SpawnEntities(this, true); PlayerActions.CheckGamesJoin(this, null); Loading = false; }
void CompleteLoginProcess() { Player clone = null; OnPlayerFinishConnectingEvent.Call(this); if (cancelconnecting) { cancelconnecting = false; return; } lock (PlayerInfo.Online.locker) { // Check if any players online have same name Player[] players = PlayerInfo.Online.Items; foreach (Player pl in players) { if (pl.truename == truename) { clone = pl; break; } } // Remove clone from list (hold lock for as short time as possible) if (clone != null && Server.Config.VerifyNames) { PlayerInfo.Online.Remove(clone); } id = NextFreeId(); PlayerInfo.Online.Add(this); } if (clone != null && Server.Config.VerifyNames) { string reason = ip == clone.ip ? "(Reconnecting)" : "(Reconnecting from a different IP)"; clone.Leave(reason); } else if (clone != null) { Leave(null, "Already logged in!", true); return; } SendRawMap(null, level); if (Socket.Disconnected) { return; } loggedIn = true; SessionStartTime = DateTime.UtcNow; LastLogin = DateTime.Now; TotalTime = TimeSpan.FromSeconds(1); GetPlayerStats(); ShowWelcome(); Server.Background.QueueOnce(ShowAltsTask, name, TimeSpan.Zero); CheckState(); PlayerDB.LoadNick(this); Game.Team = Team.TeamIn(this); SetPrefix(); LoadCpeData(); if (Server.noEmotes.Contains(name)) { parseEmotes = !Server.Config.ParseEmotes; } hideRank = Rank; hidden = CanUse("Hide") && Server.hidden.Contains(name); if (hidden) { Message("&8Reminder: You are still hidden."); } if (Chat.AdminchatPerms.UsableBy(Rank) && Server.Config.AdminsJoinSilently) { hidden = true; adminchat = true; } OnPlayerConnectEvent.Call(this); if (cancellogin) { cancellogin = false; return; } string joinMsg = "&a+ λFULL &S" + PlayerDB.GetLoginMessage(this); if (hidden) { joinMsg = "&8(hidden)" + joinMsg; } if (Server.Config.GuestJoinsNotify || Rank > LevelPermission.Guest) { Chat.MessageFrom(ChatScope.All, this, joinMsg, null, Chat.FilterVisible(this), !hidden); } if (Server.Config.AgreeToRulesOnEntry && Rank == LevelPermission.Guest && !Server.agreed.Contains(name)) { Message("&9You must read the &c/Rules &9and &c/Agree &9to them before you can build and use commands!"); agreed = false; } CheckIsUnverified(); if (CanUse("Inbox") && Database.TableExists("Inbox" + name)) { int count = Database.CountRows("Inbox" + name); if (count > 0) { Message("You have &a" + count + " &Smessages in &T/Inbox"); } } if (Server.Config.PositionUpdateInterval > 1000) { Message("Lowlag mode is currently &aON."); } if (String.IsNullOrEmpty(appName)) { Logger.Log(LogType.UserActivity, "{0} [{1}] connected.", truename, IP); } else { Logger.Log(LogType.UserActivity, "{0} [{1}] connected using {2}.", truename, IP, appName); } PlayerActions.PostSentMap(this, null, level, false); Loading = false; }