Update VersionFetcher regex for upstream versioning changes
Spigot dropped the -R0.1 from their version. `1.14.2-R0.1-SNAPSHOT` -> `1.14.3-SNAPSHOT` If this is changed upstream this commit can be reverted.
This commit is contained in:
parent
73983e4c16
commit
56ee5647ab
|
@ -1,4 +1,4 @@
|
||||||
From 6383ef269e602f8ecc8b9043942b1f967dd2ce6a Mon Sep 17 00:00:00 2001
|
From ff5e58ca90c1829949af2e08fe7ace095a0ed37a Mon Sep 17 00:00:00 2001
|
||||||
From: Zach Brown <zach@zachbr.io>
|
From: Zach Brown <zach@zachbr.io>
|
||||||
Date: Mon, 27 May 2019 03:40:05 -0500
|
Date: Mon, 27 May 2019 03:40:05 -0500
|
||||||
Subject: [PATCH] Implement Paper VersionChecker
|
Subject: [PATCH] Implement Paper VersionChecker
|
||||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Implement Paper VersionChecker
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000..ded51d042b
|
index 000000000..1279072ff
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||||
@@ -0,0 +1,115 @@
|
@@ -0,0 +1,115 @@
|
||||||
|
@ -24,7 +24,7 @@ index 0000000000..ded51d042b
|
||||||
+import java.net.URL;
|
+import java.net.URL;
|
||||||
+
|
+
|
||||||
+public class PaperVersionFetcher implements VersionFetcher {
|
+public class PaperVersionFetcher implements VersionFetcher {
|
||||||
+ private static final java.util.regex.Pattern VER_PATTERN = java.util.regex.Pattern.compile("^([0-9\\.]*)\\-.*R"); // R is an anchor, will always give '-R' at end
|
+ private static final java.util.regex.Pattern VER_PATTERN = java.util.regex.Pattern.compile("^([0-9.]*)-(pre[0-9].*-S|S)"); // S is an anchor, will always give '-S' at end
|
||||||
+ private static final String GITHUB_BRANCH_NAME = "ver/1.14";
|
+ private static final String GITHUB_BRANCH_NAME = "ver/1.14";
|
||||||
+ private static @Nullable String mcVer;
|
+ private static @Nullable String mcVer;
|
||||||
+
|
+
|
||||||
|
@ -45,7 +45,7 @@ index 0000000000..ded51d042b
|
||||||
+ java.util.regex.Matcher matcher = VER_PATTERN.matcher(org.bukkit.Bukkit.getBukkitVersion());
|
+ java.util.regex.Matcher matcher = VER_PATTERN.matcher(org.bukkit.Bukkit.getBukkitVersion());
|
||||||
+ if (matcher.find()) {
|
+ if (matcher.find()) {
|
||||||
+ String result = matcher.group();
|
+ String result = matcher.group();
|
||||||
+ mcVer = result.substring(0, result.length() - 2); // strip 'R' anchor and trailing '-'
|
+ mcVer = result.substring(0, result.length() - 2); // strip 'S' anchor and trailing '-'
|
||||||
+ } else {
|
+ } else {
|
||||||
+ org.bukkit.Bukkit.getLogger().warning("Unable to match version to pattern! Report to PaperMC!");
|
+ org.bukkit.Bukkit.getLogger().warning("Unable to match version to pattern! Report to PaperMC!");
|
||||||
+ org.bukkit.Bukkit.getLogger().warning("Pattern: " + VER_PATTERN.toString());
|
+ org.bukkit.Bukkit.getLogger().warning("Pattern: " + VER_PATTERN.toString());
|
||||||
|
@ -126,7 +126,7 @@ index 0000000000..ded51d042b
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||||
index f7fdd0727b..ee5616cdfc 100644
|
index fa32d4bb7..f9059b257 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||||
@@ -276,6 +276,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
@@ -276,6 +276,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||||
|
@ -142,5 +142,5 @@ index f7fdd0727b..ee5616cdfc 100644
|
||||||
|
|
||||||
/**
|
/**
|
||||||
--
|
--
|
||||||
2.21.0
|
2.22.0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue