mirror of
https://github.com/CyberL1/Minecraft-Realms-Emulator.git
synced 2024-12-22 04:18:21 -05:00
refactor: fix motd showing as "..." on minecraft >1.21.1, SlotsResponse.Options now has proper typing
This commit is contained in:
parent
d302ea46e2
commit
54a05537c4
@ -7,7 +7,6 @@ using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Entities;
|
||||
using Minecraft_Realms_Emulator.Shared.Requests;
|
||||
using Minecraft_Realms_Emulator.Shared.Responses;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Modes.External
|
||||
{
|
||||
@ -73,6 +72,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot.GameMode,
|
||||
Hardcore = activeSlot.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -114,6 +115,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot.GameMode,
|
||||
Hardcore = activeSlot.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -173,6 +176,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot.GameMode,
|
||||
Hardcore = activeSlot.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -227,6 +232,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot.GameMode,
|
||||
Hardcore = activeSlot.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -325,6 +332,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot.GameMode,
|
||||
Hardcore = activeSlot.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -368,6 +377,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot.GameMode,
|
||||
Hardcore = activeSlot.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -432,25 +443,26 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
slots.Add(new SlotResponse()
|
||||
{
|
||||
SlotId = slot.SlotId,
|
||||
Options = JsonConvert.SerializeObject(new
|
||||
Options =
|
||||
{
|
||||
slotName = slot.SlotName,
|
||||
gameMode = slot.GameMode,
|
||||
difficulty = slot.Difficulty,
|
||||
spawnProtection = slot.SpawnProtection,
|
||||
forceGameMode = slot.ForceGameMode,
|
||||
pvp = slot.Pvp,
|
||||
spawnAnimals = slot.SpawnAnimals,
|
||||
spawnMonsters = slot.SpawnMonsters,
|
||||
spawnNPCs = slot.SpawnNPCs,
|
||||
commandBlocks = slot.CommandBlocks,
|
||||
version = slot.Version,
|
||||
compatibility
|
||||
})
|
||||
SlotName = slot.SlotName,
|
||||
GameMode = slot.GameMode,
|
||||
Hardcore = slot.GameMode == 3,
|
||||
Difficulty = slot.Difficulty,
|
||||
SpawnProtection = slot.SpawnProtection,
|
||||
ForceGameMode = slot.ForceGameMode,
|
||||
Pvp = slot.Pvp,
|
||||
SpawnAnimals = slot.SpawnAnimals,
|
||||
SpawnMonsters = slot.SpawnMonsters,
|
||||
SpawnNPCs = slot.SpawnNPCs,
|
||||
CommandBlocks = slot.CommandBlocks,
|
||||
Version = slot.Version,
|
||||
Compatibility = compatibility
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var activeSlotOptions = JsonConvert.DeserializeObject<SlotOptionsResponse>(slots.Find(s => s.SlotId == activeSlot.SlotId).Options);
|
||||
SlotOptionsResponse activeSlotOptions = slots.Find(s => s.SlotId == activeSlot.SlotId).Options;
|
||||
|
||||
if (world.ParentWorld != null)
|
||||
{
|
||||
@ -464,6 +476,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot.GameMode,
|
||||
Hardcore = activeSlot.GameMode == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
|
@ -8,7 +8,6 @@ using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Entities;
|
||||
using Minecraft_Realms_Emulator.Shared.Requests;
|
||||
using Minecraft_Realms_Emulator.Shared.Responses;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
|
||||
@ -76,6 +75,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot.GameMode,
|
||||
Hardcore = activeSlot.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -117,6 +118,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot.GameMode,
|
||||
Hardcore = activeSlot.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -176,6 +179,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot.GameMode,
|
||||
Hardcore = activeSlot.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -230,6 +235,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot.GameMode,
|
||||
Hardcore = activeSlot.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -328,6 +335,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot.GameMode,
|
||||
Hardcore = activeSlot.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -371,6 +380,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot.GameMode,
|
||||
Hardcore = activeSlot.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -435,25 +446,26 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
slots.Add(new SlotResponse()
|
||||
{
|
||||
SlotId = slot.SlotId,
|
||||
Options = JsonConvert.SerializeObject(new
|
||||
Options =
|
||||
{
|
||||
slotName = slot.SlotName,
|
||||
gameMode = slot.GameMode,
|
||||
difficulty = slot.Difficulty,
|
||||
spawnProtection = slot.SpawnProtection,
|
||||
forceGameMode = slot.ForceGameMode,
|
||||
pvp = slot.Pvp,
|
||||
spawnAnimals = slot.SpawnAnimals,
|
||||
spawnMonsters = slot.SpawnMonsters,
|
||||
spawnNPCs = slot.SpawnNPCs,
|
||||
commandBlocks = slot.CommandBlocks,
|
||||
version = slot.Version,
|
||||
compatibility
|
||||
})
|
||||
SlotName = slot.SlotName,
|
||||
GameMode = slot.GameMode,
|
||||
Hardcore = slot.Difficulty == 3,
|
||||
Difficulty = slot.Difficulty,
|
||||
SpawnProtection = slot.SpawnProtection,
|
||||
ForceGameMode = slot.ForceGameMode,
|
||||
Pvp = slot.Pvp,
|
||||
SpawnAnimals = slot.SpawnAnimals,
|
||||
SpawnMonsters = slot.SpawnMonsters,
|
||||
SpawnNPCs = slot.SpawnNPCs,
|
||||
CommandBlocks = slot.CommandBlocks,
|
||||
Version = slot.Version,
|
||||
Compatibility = compatibility
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var activeSlotOptions = JsonConvert.DeserializeObject<SlotOptionsResponse>(slots.Find(s => s.SlotId == activeSlot.SlotId).Options);
|
||||
SlotOptionsResponse activeSlotOptions = slots.Find(s => s.SlotId == activeSlot.SlotId).Options;
|
||||
|
||||
if (world.ParentWorld != null)
|
||||
{
|
||||
@ -467,6 +479,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot.GameMode,
|
||||
Hardcore = activeSlot.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
|
@ -5,5 +5,6 @@ namespace Minecraft_Realms_Emulator.Shared.Responses
|
||||
public class SlotOptionsResponse : SlotOptionsRequest
|
||||
{
|
||||
public string Compatibility { get; set; } = null!;
|
||||
public bool Hardcore { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,11 @@
|
||||
public class SlotResponse
|
||||
{
|
||||
public int SlotId { get; set; }
|
||||
public string Options { get; set; } = null!;
|
||||
public SlotOptionsResponse Options { get; set; } = null!;
|
||||
|
||||
public SlotResponse()
|
||||
{
|
||||
Options = new SlotOptionsResponse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ namespace Minecraft_Realms_Emulator.Shared.Responses
|
||||
public class WorldResponse : World
|
||||
{
|
||||
public string RemoteSubscriptionId { get; set; } = new Guid().ToString();
|
||||
public bool Hardcore { get; set; }
|
||||
public int GameMode { get; set; }
|
||||
public int DaysLeft { get; set; } = 30;
|
||||
public bool Expired { get; set; } = false;
|
||||
public bool ExpiredTrial { get; set; } = false;
|
||||
|
Loading…
Reference in New Issue
Block a user