public ActionResult <PlayfieldInfo[]> Playfields()
        {
            if (PlayfieldManager.Playfields == null)
            {
                PlayfieldManager.ReadPlayfields();
            }

            if (UserService.CurrentUser.Role == Role.VIP)
            {
                var CurrentPlayer = PlayerManager.CurrentPlayer;
                var Faction       = CurrentPlayer?.FactionId;
                if (Faction == 0)
                {
                    return new PlayfieldInfo[] { }
                }
                ;

                var FactionOnPlanets = new List <string>();
                PlayerManager.QueryPlayer(
                    PlayerDB => PlayerDB.Players.Where(P => P.FactionId == Faction),
                    P => FactionOnPlanets.Add(P.Playfield));

                return(PlayfieldManager.Playfields.Where(P => FactionOnPlanets.Contains(P.name)).ToArray());
            }

            return(PlayfieldManager.Playfields);
        }
        public IActionResult GetPlayfieldMap(string aPlayfieldname)
        {
            if (!Directory.Exists(MapsPath))
            {
                return(NotFound());
            }
            if (PlayfieldManager.Playfields == null)
            {
                PlayfieldManager.ReadPlayfields();
            }

            var PlayfieldMap = Path.Combine(
                EmpyrionConfiguration.SaveGameModPath,
                "EWA",
                "Maps",
                aPlayfieldname,
                "map.png");

            if (!System.IO.File.Exists(PlayfieldMap) && PlayfieldManager.Playfields == null)
            {
                return(NotFound());
            }

            var CurrentPlayfield = PlayfieldManager.Playfields.FirstOrDefault(P => P.name == aPlayfieldname);

            if (!System.IO.File.Exists(PlayfieldMap) && (CurrentPlayfield == null || CurrentPlayfield.isPlanet))
            {
                return(NotFound());
            }

            if (!CurrentPlayfield.isPlanet &&
                (!System.IO.File.Exists(PlayfieldMap) || (DateTime.Now - System.IO.File.GetLastWriteTime(PlayfieldMap)).TotalDays > 1))
            {
                try { ReadFromHubbleImages(PlayfieldMap); }
                catch (Exception Error)
                {
                    Logger.LogError(Error, "LoadSpace: {0} to {1}", aPlayfieldname, PlayfieldMap);
                    PlayfieldMap = Path.Combine(EmpyrionConfiguration.ModPath, @"EWALoader\EWA\ClientApp\dist\ClientApp\empty.png");
                }
            }

            DateTimeOffset?LastModified = new DateTimeOffset(System.IO.File.GetLastWriteTime(PlayfieldMap));

            return(PhysicalFile(
                       PlayfieldMap,
                       "image/png",
                       aPlayfieldname + ".png",
                       LastModified,
                       new Microsoft.Net.Http.Headers.EntityTagHeaderValue("\"" + ETagGenerator.GetETag(PlayfieldMap, System.IO.File.ReadAllBytes(PlayfieldMap)) + "\""),
                       true
                       ));
        }