mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-11-30 08:06:01 +00:00
This time it really works, trust me
This commit is contained in:
parent
b633a0b588
commit
a9ff8bbf56
24
patches/api/0001-Add-getCommit-method-to-Bukkit.patch
Normal file
24
patches/api/0001-Add-getCommit-method-to-Bukkit.patch
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
|
Date: Sat, 26 Mar 2022 23:03:39 -0500
|
||||||
|
Subject: [PATCH] Add getCommit() method to Bukkit
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||||
|
index c551010f84ac5d3ebc626c253a8f8282924152c4..80f19df4262958315d50df5104a8fea6d0b33094 100644
|
||||||
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||||
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||||
|
@@ -108,6 +108,13 @@ public final class Bukkit {
|
||||||
|
// Paper end
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Scissors start - Allow getting git commit
|
||||||
|
+ public static String getCommit() {
|
||||||
|
+ Map<String, String> attributes = JarManifests.MANIFEST_MAP;
|
||||||
|
+ return attributes.get("Git-Commit");
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* Gets the name of this server implementation.
|
||||||
|
*
|
@ -5,10 +5,14 @@ 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
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||||
index ece77f5ea4b14bbed7c070131b3251ea86764538..7437299baa0a8d720e7b374d92530169aed5aa1d 100644
|
index ece77f5ea4b14bbed7c070131b3251ea86764538..eabe002dcd1aeacf04b694da2185770f20672d2b 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||||
@@ -19,7 +19,7 @@ import java.util.stream.StreamSupport;
|
@@ -16,10 +16,11 @@ import java.io.*;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.stream.StreamSupport;
|
||||||
|
+import org.bukkit.Bukkit;
|
||||||
|
|
||||||
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\\.]*)\\-.*R"); // R is an anchor, will always give '-R' at end
|
||||||
@ -17,7 +21,7 @@ index ece77f5ea4b14bbed7c070131b3251ea86764538..7437299baa0a8d720e7b374d92530169
|
|||||||
private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads";
|
private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads";
|
||||||
private static @Nullable String mcVer;
|
private static @Nullable String mcVer;
|
||||||
|
|
||||||
@@ -31,8 +31,8 @@ public class PaperVersionFetcher implements VersionFetcher {
|
@@ -31,8 +32,8 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public Component getVersionMessage(@Nonnull String serverVersion) {
|
public Component getVersionMessage(@Nonnull String serverVersion) {
|
||||||
@ -28,12 +32,21 @@ index ece77f5ea4b14bbed7c070131b3251ea86764538..7437299baa0a8d720e7b374d92530169
|
|||||||
final Component history = getHistory();
|
final Component history = getHistory();
|
||||||
|
|
||||||
return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
|
return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
|
||||||
@@ -57,7 +57,7 @@ public class PaperVersionFetcher implements VersionFetcher {
|
@@ -56,13 +57,10 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||||
|
|
||||||
private static Component getUpdateStatusMessage(@Nonnull String repo, @Nonnull String branch, @Nonnull String versionInfo) {
|
private static Component getUpdateStatusMessage(@Nonnull String repo, @Nonnull String branch, @Nonnull String versionInfo) {
|
||||||
int distance;
|
int distance;
|
||||||
try {
|
- try {
|
||||||
- int jenkinsBuild = Integer.parseInt(versionInfo);
|
- int jenkinsBuild = Integer.parseInt(versionInfo);
|
||||||
+ int jenkinsBuild = Integer.parseInt("force-git");
|
- distance = fetchDistanceFromSiteApi(jenkinsBuild, getMinecraftVersion());
|
||||||
distance = fetchDistanceFromSiteApi(jenkinsBuild, getMinecraftVersion());
|
- } catch (NumberFormatException ignored) {
|
||||||
} catch (NumberFormatException ignored) {
|
- versionInfo = versionInfo.replace("\"", "");
|
||||||
versionInfo = versionInfo.replace("\"", "");
|
- distance = fetchDistanceFromGitHub(repo, branch, versionInfo);
|
||||||
|
- }
|
||||||
|
+ // Scissors start - always use Git for version checking
|
||||||
|
+ versionInfo = Bukkit.getCommit();
|
||||||
|
+ distance = fetchDistanceFromGitHub(repo, branch, versionInfo);
|
||||||
|
+ // Scissors end
|
||||||
|
|
||||||
|
switch (distance) {
|
||||||
|
case -1:
|
||||||
|
Loading…
Reference in New Issue
Block a user