mirror of
https://github.com/CyberL1/MyMcRealms.git
synced 2024-11-23 14:38:21 -05:00
feat: changing realm status changes the whitelist status
This commit is contained in:
parent
9115402ff1
commit
2dea13e5c9
@ -13,9 +13,10 @@ namespace Minecraft_Realms_Emulator.Controllers
|
||||
[HttpPost("{wId}/{uuid}")]
|
||||
public async Task<ActionResult<OpsResponse>> OpPlayer(int wId, string uuid)
|
||||
{
|
||||
var api = new MyMcAPI(Environment.GetEnvironmentVariable("MYMC_API_KEY"));
|
||||
var world = (await api.GetAllServers()).Servers[wId];
|
||||
|
||||
var _api = new MyMcAPI(Environment.GetEnvironmentVariable("MYMC_API_KEY"));
|
||||
var world = (await _api.GetAllServers()).Servers[wId];
|
||||
var api = new MyMcAPI(world.OwnersToken);
|
||||
|
||||
var ops = world.Ops;
|
||||
var player = world.Whitelist.Find(p => p.Uuid.Replace("-", "") == uuid);
|
||||
|
||||
@ -40,8 +41,9 @@ namespace Minecraft_Realms_Emulator.Controllers
|
||||
[HttpDelete("{wId}/{uuid}")]
|
||||
public async Task<ActionResult<OpsResponse>> DeopPlayerAsync(int wId, string uuid)
|
||||
{
|
||||
var api = new MyMcAPI(Environment.GetEnvironmentVariable("MYMC_API_KEY"));
|
||||
var world = (await api.GetAllServers()).Servers[wId];
|
||||
var _api = new MyMcAPI(Environment.GetEnvironmentVariable("MYMC_API_KEY"));
|
||||
var world = (await _api.GetAllServers()).Servers[wId];
|
||||
var api = new MyMcAPI(world.OwnersToken);
|
||||
|
||||
var ops = world.Ops;
|
||||
var player = world.Whitelist.Find(p => p.Uuid.Replace("-", "") == uuid);
|
||||
|
@ -125,12 +125,14 @@ namespace MyMcRealms.Controllers
|
||||
[HttpPut("{id}/open")]
|
||||
public async Task<ActionResult<bool>> Open(int id)
|
||||
{
|
||||
var worlds = await new MyMcAPI.MyMcAPI(Environment.GetEnvironmentVariable("MYMC_API_KEY")).GetAllServers();
|
||||
var world = worlds.Servers[id];
|
||||
var _api = new MyMcAPI.MyMcAPI(Environment.GetEnvironmentVariable("MYMC_API_KEY"));
|
||||
|
||||
var world = (await _api.GetAllServers()).Servers[id];
|
||||
var api = new MyMcAPI.MyMcAPI(world.OwnersToken);
|
||||
|
||||
if (world == null) return NotFound("World not found");
|
||||
|
||||
// Turn off whitelist
|
||||
api.ExecuteCommand("whitelist off");
|
||||
|
||||
return Ok(true);
|
||||
}
|
||||
@ -138,12 +140,14 @@ namespace MyMcRealms.Controllers
|
||||
[HttpPut("{id}/close")]
|
||||
public async Task<ActionResult<bool>> Close(int id)
|
||||
{
|
||||
var worlds = await new MyMcAPI.MyMcAPI(Environment.GetEnvironmentVariable("MYMC_API_KEY")).GetAllServers();
|
||||
var world = worlds.Servers[id];
|
||||
var _api = new MyMcAPI.MyMcAPI(Environment.GetEnvironmentVariable("MYMC_API_KEY"));
|
||||
|
||||
var world = (await _api.GetAllServers()).Servers[id];
|
||||
var api = new MyMcAPI.MyMcAPI(world.OwnersToken);
|
||||
|
||||
if (world == null) return NotFound("World not found");
|
||||
|
||||
// Turn on whitelist
|
||||
api.ExecuteCommand("whitelist on");
|
||||
|
||||
return Ok(true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user