mirror of
https://github.com/CyberL1/Minecraft-Realms-Emulator.git
synced 2024-11-21 21:58:21 -05:00
feat: create uninitialized world if a player doesn't have one
This commit is contained in:
parent
9183c566a6
commit
94608fd792
@ -21,6 +21,43 @@ namespace Minecraft_Realms_Emulator.Controllers
|
|||||||
{
|
{
|
||||||
var worlds = await _context.Worlds.ToListAsync();
|
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);
|
||||||
|
|
||||||
|
if (hasWorld == null)
|
||||||
|
{
|
||||||
|
var world = new World
|
||||||
|
{
|
||||||
|
RemoteSubscriptionId = Guid.NewGuid().ToString(),
|
||||||
|
Owner = playerName,
|
||||||
|
OwnerUUID = playerUUID,
|
||||||
|
Name = null,
|
||||||
|
Motd = null,
|
||||||
|
State = State.UNINITIALIZED.ToString(),
|
||||||
|
DaysLeft = 30,
|
||||||
|
Expired = false,
|
||||||
|
ExpiredTrial = false,
|
||||||
|
WorldType = WorldType.NORMAL.ToString(),
|
||||||
|
Players = [],
|
||||||
|
MaxPlayers = 10,
|
||||||
|
MinigameId = null,
|
||||||
|
MinigameName = null,
|
||||||
|
MinigameImage = null,
|
||||||
|
Slots = [],
|
||||||
|
ActiveSlot = 1,
|
||||||
|
Member = false
|
||||||
|
};
|
||||||
|
|
||||||
|
worlds.Add(world);
|
||||||
|
|
||||||
|
_context.Worlds.Add(world);
|
||||||
|
_context.SaveChanges();
|
||||||
|
}
|
||||||
|
|
||||||
ServersArray servers = new()
|
ServersArray servers = new()
|
||||||
{
|
{
|
||||||
Servers = worlds
|
Servers = worlds
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"DefaultConnection": "User Id=postgres.aquqykciubzfolgrftwa;Password=8ypKY2pSWNRrlhCt;Server=aws-0-us-west-1.pooler.supabase.com;Port=5432;Database=postgres"
|
"DefaultConnection": "User Id=postgres.aquqykciubzfolgrftwa;Password=SNYcLhJsLGiWeB2K;Server=aws-0-us-west-1.pooler.supabase.com;Port=5432;Database=postgres"
|
||||||
},
|
},
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
|
Loading…
Reference in New Issue
Block a user