feat(realms): StopServer function

This commit is contained in:
CyberL1 2024-05-27 09:54:19 +02:00
parent 7268cd0da7
commit 28e842b286
2 changed files with 12 additions and 9 deletions

View File

@ -329,15 +329,7 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
if (world == null) return NotFound("World not found");
// Stop the server
ProcessStartInfo serverProcessInfo = new();
serverProcessInfo.FileName = "docker";
serverProcessInfo.Arguments = $"container stop realm-server-{world.Id}";
Process serverProcess = new();
serverProcess.StartInfo = serverProcessInfo;
serverProcess.Start();
new DockerHelper(world).StopServer();
world.State = nameof(StateEnum.CLOSED);

View File

@ -29,6 +29,17 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Helpers
serverProcess.Start();
}
public void StopServer() {
ProcessStartInfo serverProcessInfo = new();
serverProcessInfo.FileName = "docker";
serverProcessInfo.Arguments = $"container stop realm-server-{world.Id}";
Process serverProcess = new();
serverProcess.StartInfo = serverProcessInfo;
serverProcess.Start();
}
public void DeleteServer()
{
ProcessStartInfo serverProcessInfo = new();