diff --git a/MyMcRealms/Controllers/WorldsController.cs b/MyMcRealms/Controllers/WorldsController.cs
index ff700ef..7a48406 100644
--- a/MyMcRealms/Controllers/WorldsController.cs
+++ b/MyMcRealms/Controllers/WorldsController.cs
@@ -8,6 +8,7 @@ using MyMcRealms.MyMcAPI.Responses;
using MyMcRealms.Requests;
using MyMcRealms.Responses;
using Newtonsoft.Json;
+using Semver;
namespace MyMcRealms.Controllers
{
@@ -38,7 +39,10 @@ namespace MyMcRealms.Controllers
foreach (var world in AllServers.Servers)
{
- Console.WriteLine(world.ServerName);
+ int versionsCompared = SemVersion.Parse(gameVerision, SemVersionStyles.Strict).ComparePrecedenceTo(SemVersion.Parse(world.GameVersion, SemVersionStyles.Strict));
+
+ string isCompatible = versionsCompared == 0 ? "COMPATIBLE" : versionsCompared > 0 ? "NEEDS_DOWNGRADE" : "NEEDS_UPGRADE";
+
WorldResponse response = new()
{
Id = AllServers.Servers.IndexOf(world),
@@ -58,7 +62,8 @@ namespace MyMcRealms.Controllers
DaysLeft = 0,
Expired = false,
ExpiredTrial = false,
- Compatibility = world.GameVersion == gameVerision ? "COMPATIBLE" : "INCOMPATIBLE"
+ Compatibility = isCompatible,
+ ActiveVersion = world.GameVersion
};
allWorlds.Add(response);
diff --git a/MyMcRealms/MyMcRealms.csproj b/MyMcRealms/MyMcRealms.csproj
index 4021764..c64e1e8 100644
--- a/MyMcRealms/MyMcRealms.csproj
+++ b/MyMcRealms/MyMcRealms.csproj
@@ -16,6 +16,7 @@
+
diff --git a/MyMcRealms/Responses/WorldResponse.cs b/MyMcRealms/Responses/WorldResponse.cs
index fd81f85..fdcfc1c 100644
--- a/MyMcRealms/Responses/WorldResponse.cs
+++ b/MyMcRealms/Responses/WorldResponse.cs
@@ -7,5 +7,6 @@
public bool Expired { get; set; } = false;
public bool ExpiredTrial { get; set; } = false;
public string Compatibility { get; set; } = string.Empty;
+ public string ActiveVersion { get; set; } = string.Empty;
}
}
\ No newline at end of file