Fix version regex on 1.14.3 (#2622) @JRoy

This commit is contained in:
Josh Roy 2019-06-25 02:18:16 -04:00 committed by md678685
parent 9089fe8be3
commit 8ff1ebd7c2
2 changed files with 9 additions and 2 deletions

View File

@ -23,8 +23,9 @@ public class VersionUtil {
public static final BukkitVersion v1_14_R01 = BukkitVersion.fromString("1.14-R0.1-SNAPSHOT"); public static final BukkitVersion v1_14_R01 = BukkitVersion.fromString("1.14-R0.1-SNAPSHOT");
public static final BukkitVersion v1_14_1_R01 = BukkitVersion.fromString("1.14.1-R0.1-SNAPSHOT"); public static final BukkitVersion v1_14_1_R01 = BukkitVersion.fromString("1.14.1-R0.1-SNAPSHOT");
public static final BukkitVersion v1_14_2_R01 = BukkitVersion.fromString("1.14.2-R0.1-SNAPSHOT"); public static final BukkitVersion v1_14_2_R01 = BukkitVersion.fromString("1.14.2-R0.1-SNAPSHOT");
public static final BukkitVersion v1_14_3 = BukkitVersion.fromString("1.14.3-SNAPSHOT");
private static final Set<BukkitVersion> supportedVersions = ImmutableSet.of(v1_8_8_R01, v1_9_4_R01, v1_10_2_R01, v1_11_2_R01, v1_12_2_R01, v1_13_2_R01, v1_14_2_R01); private static final Set<BukkitVersion> supportedVersions = ImmutableSet.of(v1_8_8_R01, v1_9_4_R01, v1_10_2_R01, v1_11_2_R01, v1_12_2_R01, v1_13_2_R01, v1_14_3);
private static BukkitVersion serverVersion = null; private static BukkitVersion serverVersion = null;
@ -40,7 +41,7 @@ public class VersionUtil {
} }
public static class BukkitVersion implements Comparable<BukkitVersion> { public static class BukkitVersion implements Comparable<BukkitVersion> {
private static final Pattern VERSION_PATTERN = Pattern.compile("^(\\d+)\\.(\\d+)\\.?([0-9]*)?-(?:pre(\\d))?-?R?([\\d.]+)?(?:-SNAPSHOT)?"); private static final Pattern VERSION_PATTERN = Pattern.compile("^(\\d+)\\.(\\d+)\\.?([0-9]*)?(?:-pre(\\d))?(?:-?R?([\\d.]+))?(?:-SNAPSHOT)?");
private final int major; private final int major;
private final int minor; private final int minor;

View File

@ -216,5 +216,11 @@ public class UtilTest extends TestCase {
assertEquals(v.getPatch(), 2); assertEquals(v.getPatch(), 2);
assertEquals(v.getRevision(), 0.1); assertEquals(v.getRevision(), 0.1);
assertEquals(v.getPrerelease(), 1); assertEquals(v.getPrerelease(), 1);
v = VersionUtil.BukkitVersion.fromString("1.14.3-SNAPSHOT");
assertEquals(v.getMajor(), 1);
assertEquals(v.getMinor(), 14);
assertEquals(v.getPatch(), 3);
assertEquals(v.getRevision(), 0.0);
assertEquals(v.getPrerelease(), -1);
} }
} }