diff --git a/Minecraft-Realms-Emulator/Modes/External/WorldsController.cs b/Minecraft-Realms-Emulator/Modes/External/WorldsController.cs index a2f1245..1267279 100644 --- a/Minecraft-Realms-Emulator/Modes/External/WorldsController.cs +++ b/Minecraft-Realms-Emulator/Modes/External/WorldsController.cs @@ -409,6 +409,17 @@ namespace Minecraft_Realms_Emulator.Modes.External var world = await _context.Worlds.Include(w => w.Players).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.ParentWorld.Subscription).FirstOrDefaultAsync(w => w.Id == wId); + if (world.State == nameof(StateEnum.UNINITIALIZED)) + { + ErrorResponse error = new() + { + ErrorCode = 400, + ErrorMsg = "Initialize the world first" + }; + + return StatusCode(400, error); + } + Slot activeSlot = world.Slots.Find(s => s.SlotId == world.ActiveSlot); List slots = []; diff --git a/Minecraft-Realms-Emulator/Modes/Realms/Controllers/WorldsController.cs b/Minecraft-Realms-Emulator/Modes/Realms/Controllers/WorldsController.cs index ce99c75..44c6172 100644 --- a/Minecraft-Realms-Emulator/Modes/Realms/Controllers/WorldsController.cs +++ b/Minecraft-Realms-Emulator/Modes/Realms/Controllers/WorldsController.cs @@ -412,6 +412,17 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers var world = await _context.Worlds.Include(w => w.Players).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.ParentWorld.Subscription).FirstOrDefaultAsync(w => w.Id == wId); + if (world.State == nameof(StateEnum.UNINITIALIZED)) + { + ErrorResponse error = new() + { + ErrorCode = 400, + ErrorMsg = "Initialize the world first" + }; + + return StatusCode(400, error); + } + Slot activeSlot = world.Slots.Find(s => s.SlotId == world.ActiveSlot); List slots = [];