1
1
mirror of https://github.com/CyberL1/MyMcRealms.git synced 2025-04-02 14:08:36 -04:00

Compare commits

...

2 Commits

Author SHA1 Message Date
f631b7519c feat: better sounding error message 2024-05-21 14:45:25 +02:00
42397e6f93 feat: handle failed /whitelist attempts 2024-05-21 14:42:15 +02:00

View File

@ -86,9 +86,12 @@ 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 data 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";