Skip to content

Commit

Permalink
MCVersion should compare MINOR version rather than detailed version!
Browse files Browse the repository at this point in the history
  • Loading branch information
EverNife committed Feb 11, 2023
1 parent 12fdaec commit 5092083
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,23 @@ public enum MCDetailedVersion {

// Operations
private int value;
private int shortValue;
private String shortVersion;

MCDetailedVersion(int value, String ShortVersion) {
MCDetailedVersion(int value, String shortVersion) {
this.value = value;
this.shortVersion = ShortVersion;
this.shortValue = Integer.parseInt(shortVersion.replace("v", "").replace("_", ""));
this.shortVersion = shortVersion;
}

public int getValue() {
return value;
}

public int getShortValue() {
return shortValue;
}

public String getShortVersion() {
return shortVersion;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ public MCDetailedVersion getDetailedVersion() {
}

public static boolean isLower(MCVersion otherVersion) {
return MCDetailedVersion.getCurrent().isLower(otherVersion.getDetailedVersion());
return MCDetailedVersion.getCurrent().getShortValue() < otherVersion.getDetailedVersion().getShortValue();
}

public static boolean isLowerEquals(MCVersion otherVersion) {
return MCDetailedVersion.getCurrent().isLowerEquals(otherVersion.getDetailedVersion());
return MCDetailedVersion.getCurrent().getShortValue() <= otherVersion.getDetailedVersion().getShortValue();
}

public static boolean isEqual(MCVersion otherVersion) {
return MCDetailedVersion.getCurrent().isEqual(otherVersion.getDetailedVersion());
return MCDetailedVersion.getCurrent().getShortValue() == otherVersion.getDetailedVersion().getShortValue();
}

public static boolean isHigher(MCVersion otherVersion) {
return MCDetailedVersion.getCurrent().isHigher(otherVersion.getDetailedVersion());
return MCDetailedVersion.getCurrent().getShortValue() > otherVersion.getDetailedVersion().getShortValue();
}

public static boolean isHigherEquals(MCVersion otherVersion) {
return MCDetailedVersion.getCurrent().isHigherEquals(otherVersion.getDetailedVersion());
return MCDetailedVersion.getCurrent().getShortValue() >= otherVersion.getDetailedVersion().getShortValue();
}

// -----------------------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit 5092083

Please sign in to comment.