Build AsminVoicechat / prepare-release (push) Successful in 14s
Build AsminVoicechat / build-and-test (17) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (18) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (19) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (20) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (21) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (22) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (23) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (24) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (25) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (26) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (27-ea) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (16) (push) Canceled after 38s
78 lines
2.3 KiB
Java
78 lines
2.3 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* javax.annotation.Nullable
|
|
*/
|
|
package de.maxhenkel.voicechat;
|
|
|
|
import de.maxhenkel.voicechat.Version;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
import javax.annotation.Nullable;
|
|
|
|
public class BukkitVersion
|
|
extends Version {
|
|
public static final Pattern BUKKIT_VERSION_REGEX = Pattern.compile("^(?<major>\\d+)\\.(?<minor>\\d+)(?:\\.(?<patch>\\d+))?-R(?<revision>[\\d.-]+)(?:-SNAPSHOT)?$");
|
|
protected final String revision;
|
|
|
|
public BukkitVersion(int major, int minor, int patch, String revision) {
|
|
super(major, minor, patch);
|
|
this.revision = revision;
|
|
}
|
|
|
|
private static BukkitVersion fromRegex(Matcher matcher) {
|
|
String major = matcher.group("major");
|
|
String minor = matcher.group("minor");
|
|
String patch = matcher.group("patch");
|
|
String revision = matcher.group("revision");
|
|
if (patch == null || patch.isEmpty()) {
|
|
patch = "0";
|
|
}
|
|
return new BukkitVersion(Integer.parseInt(major), Integer.parseInt(minor), Integer.parseInt(patch), revision);
|
|
}
|
|
|
|
@Nullable
|
|
public static BukkitVersion parseBukkitVersion(String bukkitVersion) {
|
|
Matcher targetMatcher = BUKKIT_VERSION_REGEX.matcher(bukkitVersion);
|
|
if (!targetMatcher.matches()) {
|
|
return null;
|
|
}
|
|
return BukkitVersion.fromRegex(targetMatcher);
|
|
}
|
|
|
|
@Nullable
|
|
public static BukkitVersion getTargetVersion() {
|
|
return BukkitVersion.parseBukkitVersion("1.8.8-R0.1-SNAPSHOT");
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object o) {
|
|
if (this == o) {
|
|
return true;
|
|
}
|
|
if (!(o instanceof BukkitVersion)) {
|
|
return false;
|
|
}
|
|
BukkitVersion that = (BukkitVersion)o;
|
|
if (this.major != that.major) {
|
|
return false;
|
|
}
|
|
if (this.minor != that.minor) {
|
|
return false;
|
|
}
|
|
if (this.patch != that.patch) {
|
|
return false;
|
|
}
|
|
return this.revision.equals(that.revision);
|
|
}
|
|
|
|
public String toString() {
|
|
if (this.patch <= 0) {
|
|
return this.major + "." + this.minor + "-R" + this.revision;
|
|
}
|
|
return this.major + "." + this.minor + "." + this.patch + "-R" + this.revision;
|
|
}
|
|
}
|
|
|