feat(server): Get server's address from its MOTD in external mode

This commit is contained in:
CyberL1 2024-07-14 18:16:15 +02:00
parent fe1c7aaf63
commit f133c237ef

View File

@ -517,7 +517,6 @@ namespace Minecraft_Realms_Emulator.Modes.External
var connection = new Connection
{
World = world,
Address = defaultServerAddress.Value
};
Slot slot = new()
@ -825,7 +824,10 @@ namespace Minecraft_Realms_Emulator.Modes.External
[HttpGet("v1/{wId}/join/pc")]
public 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);
// Set the server's addrees to its MOTD
connection.Address = connection.World.Motd;
return Ok(connection);
}