mirror of
https://github.com/CyberL1/Minecraft-Realms-Emulator.git
synced 2024-12-22 12:28:21 -05:00
fix: world slots
This commit is contained in:
parent
54a05537c4
commit
4605ac5fef
@ -7,6 +7,7 @@ using Minecraft_Realms_Emulator.Shared.Data;
|
|||||||
using Minecraft_Realms_Emulator.Shared.Entities;
|
using Minecraft_Realms_Emulator.Shared.Entities;
|
||||||
using Minecraft_Realms_Emulator.Shared.Requests;
|
using Minecraft_Realms_Emulator.Shared.Requests;
|
||||||
using Minecraft_Realms_Emulator.Shared.Responses;
|
using Minecraft_Realms_Emulator.Shared.Responses;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Minecraft_Realms_Emulator.Modes.External
|
namespace Minecraft_Realms_Emulator.Modes.External
|
||||||
{
|
{
|
||||||
@ -73,7 +74,7 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot.GameMode,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -116,7 +117,7 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot.GameMode,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -177,7 +178,7 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot.GameMode,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -233,7 +234,7 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot.GameMode,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -333,7 +334,7 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot.GameMode,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -378,7 +379,7 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot.GameMode,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -443,26 +444,26 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
slots.Add(new SlotResponse()
|
slots.Add(new SlotResponse()
|
||||||
{
|
{
|
||||||
SlotId = slot.SlotId,
|
SlotId = slot.SlotId,
|
||||||
Options =
|
Options = JsonConvert.SerializeObject(new
|
||||||
{
|
{
|
||||||
SlotName = slot.SlotName,
|
slotName = slot.SlotName,
|
||||||
GameMode = slot.GameMode,
|
gameMode = slot.GameMode,
|
||||||
Hardcore = slot.GameMode == 3,
|
hardcore = slot.Difficulty == 3,
|
||||||
Difficulty = slot.Difficulty,
|
difficulty = slot.Difficulty,
|
||||||
SpawnProtection = slot.SpawnProtection,
|
spawnProection = slot.SpawnProtection,
|
||||||
ForceGameMode = slot.ForceGameMode,
|
forceGameMode = slot.ForceGameMode,
|
||||||
Pvp = slot.Pvp,
|
pvp = slot.Pvp,
|
||||||
SpawnAnimals = slot.SpawnAnimals,
|
spawnAnimals = slot.SpawnAnimals,
|
||||||
SpawnMonsters = slot.SpawnMonsters,
|
spawnMonsters = slot.SpawnMonsters,
|
||||||
SpawnNPCs = slot.SpawnNPCs,
|
spawnNPCs = slot.SpawnNPCs,
|
||||||
CommandBlocks = slot.CommandBlocks,
|
commandBlocks = slot.CommandBlocks,
|
||||||
Version = slot.Version,
|
version = slot.Version,
|
||||||
Compatibility = compatibility
|
compatibility
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
SlotOptionsResponse activeSlotOptions = slots.Find(s => s.SlotId == activeSlot.SlotId).Options;
|
var activeSlotOptions = JsonConvert.DeserializeObject<SlotOptionsResponse>(slots.Find(s => s.SlotId == activeSlot.SlotId).Options);
|
||||||
|
|
||||||
if (world.ParentWorld != null)
|
if (world.ParentWorld != null)
|
||||||
{
|
{
|
||||||
@ -477,7 +478,7 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot.GameMode,
|
||||||
Hardcore = activeSlot.GameMode == 3,
|
IsHardcore = activeSlot.GameMode == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
|
@ -10,6 +10,7 @@ using Minecraft_Realms_Emulator.Shared.Requests;
|
|||||||
using Minecraft_Realms_Emulator.Shared.Responses;
|
using Minecraft_Realms_Emulator.Shared.Responses;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||||
{
|
{
|
||||||
@ -76,7 +77,7 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot.GameMode,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -119,7 +120,7 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot.GameMode,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -180,7 +181,7 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot.GameMode,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -236,7 +237,7 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot.GameMode,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -336,7 +337,7 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot.GameMode,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -381,7 +382,7 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot.GameMode,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -446,26 +447,26 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
slots.Add(new SlotResponse()
|
slots.Add(new SlotResponse()
|
||||||
{
|
{
|
||||||
SlotId = slot.SlotId,
|
SlotId = slot.SlotId,
|
||||||
Options =
|
Options = JsonConvert.SerializeObject(new
|
||||||
{
|
{
|
||||||
SlotName = slot.SlotName,
|
slotName = slot.SlotName,
|
||||||
GameMode = slot.GameMode,
|
gameMode = slot.GameMode,
|
||||||
Hardcore = slot.Difficulty == 3,
|
hardcore = slot.Difficulty == 3,
|
||||||
Difficulty = slot.Difficulty,
|
difficulty = slot.Difficulty,
|
||||||
SpawnProtection = slot.SpawnProtection,
|
spawnProection = slot.SpawnProtection,
|
||||||
ForceGameMode = slot.ForceGameMode,
|
forceGameMode = slot.ForceGameMode,
|
||||||
Pvp = slot.Pvp,
|
pvp = slot.Pvp,
|
||||||
SpawnAnimals = slot.SpawnAnimals,
|
spawnAnimals = slot.SpawnAnimals,
|
||||||
SpawnMonsters = slot.SpawnMonsters,
|
spawnMonsters = slot.SpawnMonsters,
|
||||||
SpawnNPCs = slot.SpawnNPCs,
|
spawnNPCs = slot.SpawnNPCs,
|
||||||
CommandBlocks = slot.CommandBlocks,
|
commandBlocks = slot.CommandBlocks,
|
||||||
Version = slot.Version,
|
version = slot.Version,
|
||||||
Compatibility = compatibility
|
compatibility
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
SlotOptionsResponse activeSlotOptions = slots.Find(s => s.SlotId == activeSlot.SlotId).Options;
|
var activeSlotOptions = JsonConvert.DeserializeObject<SlotOptionsResponse>(slots.Find(s => s.SlotId == activeSlot.SlotId).Options);
|
||||||
|
|
||||||
if (world.ParentWorld != null)
|
if (world.ParentWorld != null)
|
||||||
{
|
{
|
||||||
@ -480,7 +481,7 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
GameMode = activeSlot.GameMode,
|
GameMode = activeSlot.GameMode,
|
||||||
Hardcore = activeSlot.Difficulty == 3,
|
IsHardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
|
@ -3,11 +3,12 @@
|
|||||||
public class SlotResponse
|
public class SlotResponse
|
||||||
{
|
{
|
||||||
public int SlotId { get; set; }
|
public int SlotId { get; set; }
|
||||||
public SlotOptionsResponse Options { get; set; } = null!;
|
public SlotSettingsResponse Settings { get; set; } = null!;
|
||||||
|
public string Options { get; set; } = null!;
|
||||||
|
|
||||||
public SlotResponse()
|
public SlotResponse()
|
||||||
{
|
{
|
||||||
Options = new SlotOptionsResponse();
|
Settings = new SlotSettingsResponse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
namespace Minecraft_Realms_Emulator.Shared.Responses
|
||||||
|
{
|
||||||
|
public class SlotSettingsResponse
|
||||||
|
{
|
||||||
|
public bool Hardcore { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -5,11 +5,12 @@ namespace Minecraft_Realms_Emulator.Shared.Responses
|
|||||||
public class WorldResponse : World
|
public class WorldResponse : World
|
||||||
{
|
{
|
||||||
public string RemoteSubscriptionId { get; set; } = new Guid().ToString();
|
public string RemoteSubscriptionId { get; set; } = new Guid().ToString();
|
||||||
public bool Hardcore { get; set; }
|
public bool IsHardcore { get; set; } = false;
|
||||||
public int GameMode { get; set; }
|
public int GameMode { get; set; }
|
||||||
public int DaysLeft { get; set; } = 30;
|
public int DaysLeft { get; set; } = 30;
|
||||||
public bool Expired { get; set; } = false;
|
public bool Expired { get; set; } = false;
|
||||||
public bool ExpiredTrial { get; set; } = false;
|
public bool ExpiredTrial { get; set; } = false;
|
||||||
|
public bool GracePeriod { get; set; } = false;
|
||||||
public string Compatibility { get; set; } = null!;
|
public string Compatibility { get; set; } = null!;
|
||||||
public List<SlotResponse> Slots { get; set; } = null!;
|
public List<SlotResponse> Slots { get; set; } = null!;
|
||||||
public string ActiveVersion { get; set; } = null!;
|
public string ActiveVersion { get; set; } = null!;
|
||||||
|
Loading…
Reference in New Issue
Block a user