fCraft.PlayerDB.FindPlayerInfoExact C# (CSharp) Method

FindPlayerInfoExact() public static method

public static FindPlayerInfoExact ( string name ) : PlayerInfo
name string
return PlayerInfo
        public static PlayerInfo FindPlayerInfoExact( string name ) {
            if( name == null ) throw new ArgumentNullException( "name" );
            lock( AddLocker ) {
                return Trie.Get( name );
            }
        }

Usage Example

Example #1
0
        static void HandleTime(string userNick, string name)
        {
            if (name == null)
            {
                IRC.SendChannelMessage("Server has been up for: " + Bold + DateTime.UtcNow.Subtract(Server.StartTime).ToMiniString());
                return;
            }
            PlayerInfo info = PlayerDB.FindPlayerInfoExact(name);

            if (info == null)
            {
                IRC.SendChannelMessage("No player found with name \"" + Bold + name + Reset + "\"");
                return;
            }

            if (info.IsOnline)
            {
                TimeSpan idle = info.PlayerObject.IdleTime;
                IRC.SendChannelMessage("Player " + Bold + "{0}" + Reset + " has spent a total of: " + Bold + "{1:F1}" + Reset +
                                       " hours (" + Bold + "{2:F1}" + Reset + " hours this session{3}",
                                       info.ClassyName, (info.TotalTime + info.TimeSinceLastLogin).TotalHours,
                                       info.TimeSinceLastLogin.TotalHours,
                                       idle > TimeSpan.FromMinutes(1) ?  ", been idle for " + Bold +
                                       string.Format("{0:F2}", idle.TotalMinutes) + Reset + " minutes)" : ")");
            }
            else
            {
                IRC.SendChannelMessage("Player " + Bold + "{0}" + Reset + " has spent a total of: "
                                       + Bold + "{1:F1}" + Reset + " hours",
                                       info.ClassyName, info.TotalTime.TotalHours);
            }
        }
All Usage Examples Of fCraft.PlayerDB::FindPlayerInfoExact