From 5a93396138a42b15273c1992b9d2724a7a6ebc3e Mon Sep 17 00:00:00 2001 From: CyberL1 Date: Sun, 8 Sep 2024 20:59:06 +0200 Subject: [PATCH] fix: close worlds on older versions if the world's version is incompatible --- MyMcRealms/Controllers/WorldsController.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/MyMcRealms/Controllers/WorldsController.cs b/MyMcRealms/Controllers/WorldsController.cs index 60a06aa..d12bf90 100644 --- a/MyMcRealms/Controllers/WorldsController.cs +++ b/MyMcRealms/Controllers/WorldsController.cs @@ -39,14 +39,21 @@ 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; + //Console.WriteLine(isOlderVersion); bool isCompatibleOnOlderVersions = isOlderVersion && !isCompatible.StartsWith("NEEDS_"); bool isBanned = world.Banlist.Any(p => p.Name == playerName); + Console.WriteLine(isCompatibleOnOlderVersions); 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"; + string worldState = !isBanned ? "OPEN" : "CLOSED"; + + if (!isCompatibleOnOlderVersions) + { + worldState = "CLOSED"; + } WorldResponse response = new() {