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.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,6 +72,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
OwnerUUID = world.OwnerUUID,
|
OwnerUUID = world.OwnerUUID,
|
||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
|
GameMode = activeSlot.GameMode,
|
||||||
|
Hardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -114,6 +115,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
OwnerUUID = world.OwnerUUID,
|
OwnerUUID = world.OwnerUUID,
|
||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
|
GameMode = activeSlot.GameMode,
|
||||||
|
Hardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -173,6 +176,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
OwnerUUID = world.OwnerUUID,
|
OwnerUUID = world.OwnerUUID,
|
||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
|
GameMode = activeSlot.GameMode,
|
||||||
|
Hardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -227,6 +232,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
OwnerUUID = world.OwnerUUID,
|
OwnerUUID = world.OwnerUUID,
|
||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
|
GameMode = activeSlot.GameMode,
|
||||||
|
Hardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -325,6 +332,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
OwnerUUID = world.OwnerUUID,
|
OwnerUUID = world.OwnerUUID,
|
||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
|
GameMode = activeSlot.GameMode,
|
||||||
|
Hardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -368,6 +377,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
OwnerUUID = world.OwnerUUID,
|
OwnerUUID = world.OwnerUUID,
|
||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
|
GameMode = activeSlot.GameMode,
|
||||||
|
Hardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -432,25 +443,26 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
slots.Add(new SlotResponse()
|
slots.Add(new SlotResponse()
|
||||||
{
|
{
|
||||||
SlotId = slot.SlotId,
|
SlotId = slot.SlotId,
|
||||||
Options = JsonConvert.SerializeObject(new
|
Options =
|
||||||
{
|
{
|
||||||
slotName = slot.SlotName,
|
SlotName = slot.SlotName,
|
||||||
gameMode = slot.GameMode,
|
GameMode = slot.GameMode,
|
||||||
difficulty = slot.Difficulty,
|
Hardcore = slot.GameMode == 3,
|
||||||
spawnProtection = slot.SpawnProtection,
|
Difficulty = slot.Difficulty,
|
||||||
forceGameMode = slot.ForceGameMode,
|
SpawnProtection = slot.SpawnProtection,
|
||||||
pvp = slot.Pvp,
|
ForceGameMode = slot.ForceGameMode,
|
||||||
spawnAnimals = slot.SpawnAnimals,
|
Pvp = slot.Pvp,
|
||||||
spawnMonsters = slot.SpawnMonsters,
|
SpawnAnimals = slot.SpawnAnimals,
|
||||||
spawnNPCs = slot.SpawnNPCs,
|
SpawnMonsters = slot.SpawnMonsters,
|
||||||
commandBlocks = slot.CommandBlocks,
|
SpawnNPCs = slot.SpawnNPCs,
|
||||||
version = slot.Version,
|
CommandBlocks = slot.CommandBlocks,
|
||||||
compatibility
|
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)
|
if (world.ParentWorld != null)
|
||||||
{
|
{
|
||||||
@ -464,6 +476,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
OwnerUUID = world.OwnerUUID,
|
OwnerUUID = world.OwnerUUID,
|
||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
|
GameMode = activeSlot.GameMode,
|
||||||
|
Hardcore = activeSlot.GameMode == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
|
@ -8,7 +8,6 @@ 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;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
|
|
||||||
@ -76,6 +75,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
OwnerUUID = world.OwnerUUID,
|
OwnerUUID = world.OwnerUUID,
|
||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
|
GameMode = activeSlot.GameMode,
|
||||||
|
Hardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -117,6 +118,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
OwnerUUID = world.OwnerUUID,
|
OwnerUUID = world.OwnerUUID,
|
||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
|
GameMode = activeSlot.GameMode,
|
||||||
|
Hardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -176,6 +179,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
OwnerUUID = world.OwnerUUID,
|
OwnerUUID = world.OwnerUUID,
|
||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
|
GameMode = activeSlot.GameMode,
|
||||||
|
Hardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -230,6 +235,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
OwnerUUID = world.OwnerUUID,
|
OwnerUUID = world.OwnerUUID,
|
||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
|
GameMode = activeSlot.GameMode,
|
||||||
|
Hardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -328,6 +335,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
OwnerUUID = world.OwnerUUID,
|
OwnerUUID = world.OwnerUUID,
|
||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
|
GameMode = activeSlot.GameMode,
|
||||||
|
Hardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -371,6 +380,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
OwnerUUID = world.OwnerUUID,
|
OwnerUUID = world.OwnerUUID,
|
||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
|
GameMode = activeSlot.GameMode,
|
||||||
|
Hardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
@ -435,25 +446,26 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
slots.Add(new SlotResponse()
|
slots.Add(new SlotResponse()
|
||||||
{
|
{
|
||||||
SlotId = slot.SlotId,
|
SlotId = slot.SlotId,
|
||||||
Options = JsonConvert.SerializeObject(new
|
Options =
|
||||||
{
|
{
|
||||||
slotName = slot.SlotName,
|
SlotName = slot.SlotName,
|
||||||
gameMode = slot.GameMode,
|
GameMode = slot.GameMode,
|
||||||
difficulty = slot.Difficulty,
|
Hardcore = slot.Difficulty == 3,
|
||||||
spawnProtection = slot.SpawnProtection,
|
Difficulty = slot.Difficulty,
|
||||||
forceGameMode = slot.ForceGameMode,
|
SpawnProtection = slot.SpawnProtection,
|
||||||
pvp = slot.Pvp,
|
ForceGameMode = slot.ForceGameMode,
|
||||||
spawnAnimals = slot.SpawnAnimals,
|
Pvp = slot.Pvp,
|
||||||
spawnMonsters = slot.SpawnMonsters,
|
SpawnAnimals = slot.SpawnAnimals,
|
||||||
spawnNPCs = slot.SpawnNPCs,
|
SpawnMonsters = slot.SpawnMonsters,
|
||||||
commandBlocks = slot.CommandBlocks,
|
SpawnNPCs = slot.SpawnNPCs,
|
||||||
version = slot.Version,
|
CommandBlocks = slot.CommandBlocks,
|
||||||
compatibility
|
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)
|
if (world.ParentWorld != null)
|
||||||
{
|
{
|
||||||
@ -467,6 +479,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
OwnerUUID = world.OwnerUUID,
|
OwnerUUID = world.OwnerUUID,
|
||||||
Name = world.Name,
|
Name = world.Name,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
|
GameMode = activeSlot.GameMode,
|
||||||
|
Hardcore = activeSlot.Difficulty == 3,
|
||||||
State = world.State,
|
State = world.State,
|
||||||
WorldType = world.WorldType,
|
WorldType = world.WorldType,
|
||||||
MaxPlayers = world.MaxPlayers,
|
MaxPlayers = world.MaxPlayers,
|
||||||
|
@ -5,5 +5,6 @@ namespace Minecraft_Realms_Emulator.Shared.Responses
|
|||||||
public class SlotOptionsResponse : SlotOptionsRequest
|
public class SlotOptionsResponse : SlotOptionsRequest
|
||||||
{
|
{
|
||||||
public string Compatibility { get; set; } = null!;
|
public string Compatibility { get; set; } = null!;
|
||||||
|
public bool Hardcore { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,11 @@
|
|||||||
public class SlotResponse
|
public class SlotResponse
|
||||||
{
|
{
|
||||||
public int SlotId { get; set; }
|
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 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 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;
|
||||||
|
Loading…
Reference in New Issue
Block a user