fCraft.World.FindPlayers C# (CSharp) Method

FindPlayers() public method

public FindPlayers ( [ player, [ playerName ) : fCraft.Player[]
player [
playerName [
return fCraft.Player[]
        public Player[] FindPlayers( [NotNull] Player player, [NotNull] string playerName )
        {
            if ( player == null )
                throw new ArgumentNullException( "player" );
            if ( playerName == null )
                throw new ArgumentNullException( "playerName" );
            Player[] tempList = Players;
            List<Player> results = new List<Player>();
            for ( int i = 0; i < tempList.Length; i++ ) {
                if ( tempList[i] != null && player.CanSee( tempList[i] ) ) {
                    if ( tempList[i].Name.Equals( playerName, StringComparison.OrdinalIgnoreCase ) ) {
                        results.Clear();
                        results.Add( tempList[i] );
                        break;
                    } else if ( tempList[i].Name.StartsWith( playerName, StringComparison.OrdinalIgnoreCase ) ) {
                        results.Add( tempList[i] );
                    }
                }
            }
            return results.ToArray();
        }