diff --git a/Minecraft-Realms-Emulator/Modes/External/WorldsController.cs b/Minecraft-Realms-Emulator/Modes/External/WorldsController.cs index a729e3b..a2f1245 100644 --- a/Minecraft-Realms-Emulator/Modes/External/WorldsController.cs +++ b/Minecraft-Realms-Emulator/Modes/External/WorldsController.cs @@ -581,43 +581,6 @@ namespace Minecraft_Realms_Emulator.Modes.External return StatusCode(401, errorResponse); } - world.Name = $"[PRE] {world.ParentWorld.Name}"; - world.Motd = $"[PRE] {world.ParentWorld.Motd}"; - world.State = nameof(StateEnum.OPEN); - - var config = new ConfigHelper(_context); - var defaultServerAddress = config.GetSetting(nameof(SettingsEnum.DefaultServerAddress)); - - var connection = new Connection - { - World = world, - Address = defaultServerAddress.Value - }; - - Slot slot = new() - { - World = world, - SlotId = 1, - SlotName = "", - Version = gameVersion, - GameMode = 0, - Difficulty = 2, - SpawnProtection = 0, - ForceGameMode = false, - Pvp = true, - SpawnAnimals = true, - SpawnMonsters = true, - SpawnNPCs = true, - CommandBlocks = false - }; - - _context.Worlds.Update(world); - - _context.Connections.Add(connection); - _context.Slots.Add(slot); - - _context.SaveChanges(); - return Ok(world); } diff --git a/Minecraft-Realms-Emulator/Modes/Realms/Controllers/WorldsController.cs b/Minecraft-Realms-Emulator/Modes/Realms/Controllers/WorldsController.cs index 0cafc8d..ce99c75 100644 --- a/Minecraft-Realms-Emulator/Modes/Realms/Controllers/WorldsController.cs +++ b/Minecraft-Realms-Emulator/Modes/Realms/Controllers/WorldsController.cs @@ -597,56 +597,6 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers return StatusCode(401, errorResponse); } - world.Name = $"[PRE] {world.ParentWorld.Name}"; - world.Motd = $"[PRE] {world.ParentWorld.Motd}"; - world.State = nameof(StateEnum.OPEN); - - var config = new ConfigHelper(_context); - var defaultServerAddress = config.GetSetting(nameof(SettingsEnum.DefaultServerAddress)); - - static int FindFreeTcpPort() - { - TcpListener l = new(IPAddress.Loopback, 0); - l.Start(); - int port = ((IPEndPoint)l.LocalEndpoint).Port; - l.Stop(); - return port; - } - - var port = FindFreeTcpPort(); - - var connection = new Connection - { - World = world, - Address = $"{defaultServerAddress.Value}:{port}" - }; - - new DockerHelper(world).CreateServer(port); - - Slot slot = new() - { - World = world, - SlotId = 1, - SlotName = "", - Version = gameVersion, - GameMode = 0, - Difficulty = 2, - SpawnProtection = 0, - ForceGameMode = false, - Pvp = true, - SpawnAnimals = true, - SpawnMonsters = true, - SpawnNPCs = true, - CommandBlocks = false - }; - - _context.Worlds.Update(world); - - _context.Connections.Add(connection); - _context.Slots.Add(slot); - - _context.SaveChanges(); - return Ok(world); }