diff --git a/MyMcRealms/Controllers/WorldsController.cs b/MyMcRealms/Controllers/WorldsController.cs index dfafd38..d57fb7b 100644 --- a/MyMcRealms/Controllers/WorldsController.cs +++ b/MyMcRealms/Controllers/WorldsController.cs @@ -33,11 +33,14 @@ namespace MyMcRealms.Controllers bool isOlderVersion = SemVersion.Parse(gameVerision, SemVersionStyles.OptionalPatch).ComparePrecedenceTo(SemVersion.Parse("1.20.3", SemVersionStyles.OptionalPatch)) < 0; string isCompatibleOnOlderVersions = (isOlderVersion && isCompatible.StartsWith("NEEDS_")) ? "CLOSED" : "OPEN"; + string worldOwnerName = world.Ops.ToArray().Length == 0 ? "Owner" : world.Ops[0].Name; + string worldOwnerUuid = world.Ops.ToArray().Length == 0 ? "069a79f444e94726a5befca90e38aaf5" : world.Ops[0].Uuid; + WorldResponse response = new() { Id = AllServers.Servers.IndexOf(world), - Owner = world.Ops[0].Name, - OwnerUUID = world.Ops[0].Uuid, + Owner = worldOwnerName, + OwnerUUID = worldOwnerUuid, Name = world.ServerName, Motd = world.Motd, State = isCompatibleOnOlderVersions, @@ -73,6 +76,30 @@ namespace MyMcRealms.Controllers return NotFound("World not found"); } +// [HttpPut("{id}/open")] +// public async Task> Open(int id) +// { +// var world = worlds.Find(w => w.Id == id); + +// if (world == null) return NotFound("World not found"); + + // Turn off whitelist + +// return Ok(true); +// } + +// [HttpPut("{id}/close")] +// public async Task> Close(int id) +// { +// var world = worlds.FirstOrDefault(w => w.Id == id); + +// if (world == null) return NotFound("World not found"); + + // Turn on whitelist + +// return Ok(true); +// } + [HttpGet("v1/{wId}/join/pc")] public async Task> Join(int wId) {