diff --git a/Minecraft-Realms-Emulator/Controllers/WorldsController.cs b/Minecraft-Realms-Emulator/Controllers/WorldsController.cs index d0240d4..2490700 100644 --- a/Minecraft-Realms-Emulator/Controllers/WorldsController.cs +++ b/Minecraft-Realms-Emulator/Controllers/WorldsController.cs @@ -208,16 +208,16 @@ namespace Minecraft_Realms_Emulator.Controllers return response; } - [HttpPost("{id}/initialize")] + [HttpPost("{wId}/initialize")] [CheckRealmOwner] - public async Task> Initialize(int id, WorldCreateRequest body) + public async Task> Initialize(int wId, WorldCreateRequest body) { string cookie = Request.Headers.Cookie; string gameVersion = cookie.Split(";")[2].Split("=")[1]; var worlds = await _context.Worlds.ToListAsync(); - var world = worlds.Find(w => w.Id == id); + var world = worlds.Find(w => w.Id == wId); if (world == null) return NotFound("World not found"); if (world.State != "UNINITIALIZED") return NotFound("World already initialized"); @@ -269,20 +269,21 @@ namespace Minecraft_Realms_Emulator.Controllers return Ok(world); } - [HttpPost("{id}/reset")] + [HttpPost("{wId}/reset")] [CheckRealmOwner] - public ActionResult Reset(int id) + public ActionResult Reset(int wId) { - Console.WriteLine($"Resetting world {id}"); + Console.WriteLine($"Resetting world {wId}"); return Ok(true); } - [HttpPut("{id}/open")] - public async Task> Open(int id) + [HttpPut("{wId}/open")] + [CheckRealmOwner] + public async Task> Open(int wId) { var worlds = await _context.Worlds.ToListAsync(); - var world = worlds.Find(w => w.Id == id); + var world = worlds.Find(w => w.Id == wId); if (world == null) return NotFound("World not found"); @@ -293,13 +294,13 @@ namespace Minecraft_Realms_Emulator.Controllers return Ok(true); } - [HttpPut("{id}/close")] + [HttpPut("{wId}/close")] [CheckRealmOwner] - public async Task> Close(int id) + public async Task> Close(int wId) { var worlds = await _context.Worlds.ToListAsync(); - var world = worlds.FirstOrDefault(w => w.Id == id); + var world = worlds.FirstOrDefault(w => w.Id == wId); if (world == null) return NotFound("World not found"); @@ -310,13 +311,13 @@ namespace Minecraft_Realms_Emulator.Controllers return Ok(true); } - [HttpPost("{id}")] + [HttpPost("{wId}")] [CheckRealmOwner] - public async Task> UpdateWorld(int id, WorldCreateRequest body) + public async Task> UpdateWorld(int wId, WorldCreateRequest body) { var worlds = await _context.Worlds.ToListAsync(); - var world = worlds.Find(w => w.Id == id); + var world = worlds.Find(w => w.Id == wId); if (world == null) return NotFound("World not found"); @@ -392,11 +393,11 @@ namespace Minecraft_Realms_Emulator.Controllers return Ok(true); } - [HttpGet("{Id}/backups")] + [HttpGet("{wId}/backups")] [CheckRealmOwner] - public async Task> GetBackups(int id) + public async Task> GetBackups(int wId) { - var backups = await _context.Backups.Where(b => b.World.Id == id).ToListAsync(); + var backups = await _context.Backups.Where(b => b.World.Id == wId).ToListAsync(); BackupsResponse worldBackups = new() {