Skip to content

Commit

Permalink
Treat MCVersion-SNAPSHOT > MCVersion.buildNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
LunNova committed Jun 22, 2016
1 parent c8c274d commit 9f9b97e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/java/me/nallar/modpatcher/ModPatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,13 @@ public int compareTo(Version that) {
Integer.parseInt(thisParts[i]) : 0;
int thatPart = i < thatParts.length ?
Integer.parseInt(thatParts[i]) : 0;

if (this.snapshot && i > thisParts.length)
thisPart = Integer.MAX_VALUE;

if (that.snapshot && i > thatParts.length)
thatPart = Integer.MAX_VALUE;

if (thisPart < thatPart)
return -1;
if (thisPart > thatPart)
Expand All @@ -397,12 +404,12 @@ public int compareTo(Version that) {

@Override
public String toString() {
return version;
return version + (snapshot ? "-SNAPSHOT" : "");
}

@Override
public int hashCode() {
return version.hashCode();
return toString().hashCode();
}

@Override
Expand Down

0 comments on commit 9f9b97e

Please sign in to comment.