mirror of
https://github.com/CyberL1/Minecraft-Realms-Emulator.git
synced 2024-11-23 14:48:22 -05:00
fix: check if world is initialized
This commit is contained in:
parent
83c43ce73d
commit
c2f62fdffb
@ -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<SlotResponse> slots = [];
|
||||
|
@ -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<SlotResponse> slots = [];
|
||||
|
Loading…
Reference in New Issue
Block a user