From 1dc7194888bce4594f1f60991b849f1246b344ba Mon Sep 17 00:00:00 2001 From: CyberL1 Date: Sat, 14 Dec 2024 19:30:06 +0100 Subject: [PATCH] fix: wait until the server is closed before returning --- .../Modes/Realms/Controllers/WorldsController.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Minecraft-Realms-Emulator/Modes/Realms/Controllers/WorldsController.cs b/Minecraft-Realms-Emulator/Modes/Realms/Controllers/WorldsController.cs index 18ce045..e18a6c9 100644 --- a/Minecraft-Realms-Emulator/Modes/Realms/Controllers/WorldsController.cs +++ b/Minecraft-Realms-Emulator/Modes/Realms/Controllers/WorldsController.cs @@ -687,6 +687,15 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers _context.SaveChanges(); + var connection = _context.Connections.FirstOrDefault(c => c.World.Id == wId); + var query = new MinecraftServerQuery().Query(connection.Address); + + while (query != null) + { + await Task.Delay(1000); + query = new MinecraftServerQuery().Query(connection.Address); + } + return Ok(true); } @@ -948,7 +957,7 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers _context.Worlds.Remove(world); _context.SaveChanges(); - return Ok(true); + return Ok(true); // 52.169.109.192:30343 } [HttpGet("templates/{type}")]