From ee981251acf047c5921e79b064ae7c1fb1de77fa Mon Sep 17 00:00:00 2001 From: XPYEX Date: Sat, 7 Jan 2023 17:01:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/me/xpyex/plugin/xplib/bukkit/api/Version.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/me/xpyex/plugin/xplib/bukkit/api/Version.java b/src/main/java/me/xpyex/plugin/xplib/bukkit/api/Version.java index f127ae7..c222cfa 100644 --- a/src/main/java/me/xpyex/plugin/xplib/bukkit/api/Version.java +++ b/src/main/java/me/xpyex/plugin/xplib/bukkit/api/Version.java @@ -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; } @@ -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; }