diff --git a/ProjectLighthouse.Servers.GameServer/Helpers/PatchworkHelper.cs b/ProjectLighthouse.Servers.GameServer/Helpers/PatchworkHelper.cs index c1ff0641..f0f5aaed 100644 --- a/ProjectLighthouse.Servers.GameServer/Helpers/PatchworkHelper.cs +++ b/ProjectLighthouse.Servers.GameServer/Helpers/PatchworkHelper.cs @@ -1,5 +1,4 @@ using LBPUnion.ProjectLighthouse.Configuration; -using LBPUnion.ProjectLighthouse.Types.Users; namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Helpers; @@ -11,27 +10,24 @@ public static class PatchworkHelper { string userAgentPrefix = "PatchworkLBP"; char gameVersion = userAgent[userAgentPrefix.Length]; - int numericVersion = 0; - if (userAgent.StartsWith(userAgentPrefix)) + if (!userAgent.StartsWith(userAgentPrefix)) return false; - if (char.IsLetterOrDigit(gameVersion)) - { - if (gameVersion == 'V') - numericVersion = 4; + switch (gameVersion) { + case '1': + case '2': + case '3': + case 'V': + break; + default: + return false; } - else - numericVersion = gameVersion - '0'; - - // Don't want it to be 0 still because of Unknown (-1) in GameVersion - if (numericVersion - 1 == 0 || !Enum.IsDefined(typeof(GameVersion), numericVersion)) - return false; string[] patchworkVer = userAgent.Split(' ')[1].Split('.'); - if (int.Parse(patchworkVer[0]) >= patchworkMajorVer && int.Parse(patchworkVer[1]) >= patchworkMinorVer) - return true; + if (int.Parse(patchworkVer[0]) !>= patchworkMajorVer || int.Parse(patchworkVer[1]) !>= patchworkMinorVer) + return false; - return false; + return true; } } \ No newline at end of file