Skip to content

Commit

Permalink
优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
0XPYEX0 committed Jan 7, 2023
1 parent a45fd66 commit ee98125
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/main/java/me/xpyex/plugin/xplib/bukkit/api/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,7 @@ public boolean equals(Object o) {
return true;
}
if (o instanceof Version) {
Version v = (Version) o;
for (int i = 0; i < versions.length; i++) {
if (v.versions[i] != this.versions[i]) {
return false;
}
} //主版本是否一致
return v.betaInfo.equals(this.betaInfo); //Beta版本是否一致
return this.compareTo((Version) o) == 0;
}
return false;
}
Expand All @@ -61,6 +55,8 @@ public boolean equals(Object o) {
public int compareTo(Version version) {
if (version == null) return -1;

if (this == version) return 0;

if (version.versions.length > this.versions.length) {
return -1;
}
Expand Down

0 comments on commit ee98125

Please sign in to comment.