fix(server): properly close/open server trough admin api

This commit is contained in:
CyberL1 2024-05-30 09:52:33 +02:00
parent 51251ee5a1
commit bf2d2ff641

View File

@ -65,6 +65,9 @@ namespace Minecraft_Realms_Emulator.Controllers.Admin
if (world == null) return BadRequest("World not found"); if (world == null) return BadRequest("World not found");
world.State = "OPEN";
_context.SaveChanges();
new DockerHelper(world).StartServer(); new DockerHelper(world).StartServer();
return Ok(true); return Ok(true);
@ -77,6 +80,9 @@ namespace Minecraft_Realms_Emulator.Controllers.Admin
if (world == null) return BadRequest("World not found"); if (world == null) return BadRequest("World not found");
world.State = "CLOSED";
_context.SaveChanges();
new DockerHelper(world).StopServer(); new DockerHelper(world).StopServer();
return Ok(true); return Ok(true);