/* * 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("^(?\\d+)\\.(?\\d+)(?:\\.(?\\d+))?-R(?[\\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; } }