mirror of
https://github.com/CyberL1/Minecraft-Realms-Emulator.git
synced 2024-11-21 21:58:21 -05:00
feat: start server if stopped on join
This commit is contained in:
parent
640cc80758
commit
c1353de565
@ -682,13 +682,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
|
|
||||||
while (query == null)
|
while (query == null)
|
||||||
{
|
{
|
||||||
|
await Task.Delay(1000);
|
||||||
var newQuery = new MinecraftServerQuery().Query(connection.Address);
|
query = new MinecraftServerQuery().Query(connection.Address);
|
||||||
|
|
||||||
if (newQuery != null)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
@ -909,9 +904,19 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("v1/{wId}/join/pc")]
|
[HttpGet("v1/{wId}/join/pc")]
|
||||||
public ActionResult<Connection> Join(int wId)
|
public async Task<ActionResult<Connection>> Join(int wId)
|
||||||
{
|
{
|
||||||
var connection = _context.Connections.FirstOrDefault(x => x.World.Id == wId);
|
var connection = _context.Connections.Include(c => c.World).FirstOrDefault(x => x.World.Id == wId);
|
||||||
|
|
||||||
|
var query = new MinecraftServerQuery().Query(connection.Address);
|
||||||
|
|
||||||
|
if (query == null) new DockerHelper(connection.World).StartServer();
|
||||||
|
|
||||||
|
while (query == null)
|
||||||
|
{
|
||||||
|
await Task.Delay(1000);
|
||||||
|
query = new MinecraftServerQuery().Query(connection.Address);
|
||||||
|
}
|
||||||
|
|
||||||
return Ok(connection);
|
return Ok(connection);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user