mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-11-30 08:06:01 +00:00
Get branch for version checking automatically
This commit is contained in:
parent
2aa83ebb1f
commit
d120903a36
@ -5,7 +5,7 @@ Subject: [PATCH] Change version fetcher to AMG
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
index ece77f5ea4b14bbed7c070131b3251ea86764538..a2897c410ace49d93ff4f7794e6f1472d60d1031 100644
|
||||
index ece77f5ea4b14bbed7c070131b3251ea86764538..f92610edcfb724374c69e66443eab60919ee955a 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
@@ -4,6 +4,8 @@ import com.destroystokyo.paper.util.VersionFetcher;
|
||||
@ -17,15 +17,17 @@ index ece77f5ea4b14bbed7c070131b3251ea86764538..a2897c410ace49d93ff4f7794e6f1472
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
@@ -19,7 +21,7 @@ import java.util.stream.StreamSupport;
|
||||
@@ -19,8 +21,8 @@ import java.util.stream.StreamSupport;
|
||||
|
||||
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 String GITHUB_BRANCH_NAME = "master";
|
||||
+ private static final String GITHUB_BRANCH_NAME = "main";
|
||||
private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads";
|
||||
- private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads";
|
||||
+ private static final String GITHUB_BRANCH_NAME = getBranch();
|
||||
+ private static final String DOWNLOAD_PAGE = "https://ci.plex.us.org/job/Scissors/job/" + GITHUB_BRANCH_NAME;
|
||||
private static @Nullable String mcVer;
|
||||
|
||||
@Override
|
||||
@@ -31,8 +33,8 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
@Nonnull
|
||||
@Override
|
||||
@ -37,15 +39,20 @@ index ece77f5ea4b14bbed7c070131b3251ea86764538..a2897c410ace49d93ff4f7794e6f1472
|
||||
final Component history = getHistory();
|
||||
|
||||
return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
|
||||
@@ -54,15 +56,19 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
@@ -54,15 +56,24 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
return mcVer;
|
||||
}
|
||||
|
||||
+ // Scissors start - Allow getting git commit
|
||||
+ // Scissors start - Allow getting git information
|
||||
+ public static String getCommit() {
|
||||
+ Map<String, String> attributes = JarManifests.MANIFEST_MAP;
|
||||
+ return attributes.get("Git-Commit");
|
||||
+ }
|
||||
+
|
||||
+ public static String getBranch() {
|
||||
+ Map<String, String> attributes = JarManifests.MANIFEST_MAP;
|
||||
+ return attributes.get("Git-Branch");
|
||||
+ }
|
||||
+ // Scissors end
|
||||
+
|
||||
private static Component getUpdateStatusMessage(@Nonnull String repo, @Nonnull String branch, @Nonnull String versionInfo) {
|
||||
|
Loading…
Reference in New Issue
Block a user