Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

Commit

Permalink
fix: versions cannot be fixed correctly or even broken
Browse files Browse the repository at this point in the history
  • Loading branch information
Cdm2883 committed Jul 16, 2024
1 parent 7175bb5 commit 1da0537
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/bridgeo/utils/mc/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ export function toInternalVersion(version: unknown): InternalVersion {
break;
case "string":
const parseVersion = (version: string) => version.split('.').map(Number);
const equals = ([ x1, y1, z1 ]: number[], [ x2, y2, z2 ]: number[]) => x1 === x2 && y1 === y2 && z1 === z2;
const curVersion = parseVersion(version);
for (const [ min, max,, internal ] of versions) {
const minVersion = parseVersion(min);
if (curVersion === minVersion) return internal;
if (equals(curVersion, minVersion)) return internal;
if (!max) continue;
const maxVersion = parseVersion(max);
if (curVersion === maxVersion) return internal;
if (equals(curVersion, maxVersion)) return internal;
if (minVersion < curVersion && curVersion < maxVersion) return internal;
}
break;
Expand Down

0 comments on commit 1da0537

Please sign in to comment.