1
0
mirror of https://github.com/CyberL1/MyMcRealms.git synced 2024-11-24 06:58:22 -05:00

fix: older versions

This commit is contained in:
CyberL1 2024-05-14 09:19:22 +02:00
parent 8a47b4a406
commit 3f0e0c12db

View File

@ -38,13 +38,14 @@ namespace MyMcRealms.Controllers
string isCompatible = versionsCompared == 0 ? "COMPATIBLE" : versionsCompared < 0 ? "NEEDS_DOWNGRADE" : "NEEDS_UPGRADE";
bool isOlderVersion = SemVersion.Parse(gameVerision, SemVersionStyles.OptionalPatch).ComparePrecedenceTo(SemVersion.Parse("1.20.3", SemVersionStyles.OptionalPatch)) < 0;
bool isCompatibleOnOlderVersions = (isOlderVersion && isCompatible.StartsWith("NEEDS_"));
bool isCompatibleOnOlderVersions = isOlderVersion && !isCompatible.StartsWith("NEEDS_");
bool isBanned = world.Banlist.Any(p => p.Name == playerName);
string worldOwnerName = world.Ops.ToArray().Length == 0 ? "Owner" : world.Ops[0].Name;
string worldOwnerUuid = world.Ops.ToArray().Length == 0 ? "069a79f444e94726a5befca90e38aaf5" : world.Ops[0].Uuid;
string worldName = world.Ops.ToArray().Length == 0 ? world.ServerName : $"{world.Ops[0].Name}'s server";
string worldState = isCompatibleOnOlderVersions || !isBanned ? "OPEN" : "CLOSED";
WorldResponse response = new()
{
@ -53,7 +54,7 @@ namespace MyMcRealms.Controllers
OwnerUUID = worldOwnerUuid,
Name = worldName,
Motd = world.Motd,
State = isCompatibleOnOlderVersions || !isBanned ? "OPEN" : "CLOSED",
State = worldState,
WorldType = "NORMAL",
MaxPlayers = 10,
MinigameId = null,