From 42397e6f931e8a205fb2830691ca535889d90dd9 Mon Sep 17 00:00:00 2001 From: CyberL1 Date: Tue, 21 May 2024 14:42:15 +0200 Subject: [PATCH] feat: handle failed /whitelist attempts --- MyMcRealms/Controllers/WorldsController.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MyMcRealms/Controllers/WorldsController.cs b/MyMcRealms/Controllers/WorldsController.cs index 602f163..d89e6e0 100644 --- a/MyMcRealms/Controllers/WorldsController.cs +++ b/MyMcRealms/Controllers/WorldsController.cs @@ -86,9 +86,11 @@ namespace MyMcRealms.Controllers var _api = new MyMcAPI.Wrapper(Environment.GetEnvironmentVariable("MYMC_API_KEY")); var world = (await _api.GetAllServers()).Servers[id]; + var api = new MyMcAPI.Wrapper(world.OwnersToken); var whitelist = await api.GetWhitelist(); + if (whitelist == null) return BadRequest($"Cannot GET /whitelist for world {id}"); string worldOwnerName = world.Ops.ToArray().Length == 0 ? "Owner" : world.Ops[0].Name; string worldOwnerUuid = world.Ops.ToArray().Length == 0 ? "069a79f444e94726a5befca90e38aaf5" : world.Ops[0].Uuid; string worldName = world.Ops.ToArray().Length == 0 ? world.ServerName : $"{world.Ops[0].Name}'s server";