fix: only show player owned worlds

This commit is contained in:
CyberL1 2024-02-21 11:46:49 +01:00
parent eeb0ddf64f
commit 05a3967799

View File

@ -19,16 +19,14 @@ namespace Minecraft_Realms_Emulator.Controllers
[HttpGet]
public async Task<ActionResult<ServersArray>> GetWorlds()
{
var worlds = await _context.Worlds.ToListAsync();
string cookie = Request.Headers.Cookie;
string playerUUID = cookie.Split(";")[0].Split(":")[2];
string playerName = cookie.Split(";")[1].Split("=")[1];
var hasWorld = worlds.Find(p => p.OwnerUUID == playerUUID);
var worlds = await _context.Worlds.Where(w => w.OwnerUUID == playerUUID).ToListAsync();
if (hasWorld == null)
if (worlds == null)
{
var world = new World
{