From 81609b1d4bb21dc9a924570e2f78473cb4dca8ac Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Tue, 19 Apr 2022 20:09:38 -0500 Subject: [PATCH] Actually fix updater --- .../server/0022-Attempt-to-fix-updater.patch | 34 ------------------- patches/server/0022-Fix-updater.patch | 32 +++++++++++++++++ 2 files changed, 32 insertions(+), 34 deletions(-) delete mode 100644 patches/server/0022-Attempt-to-fix-updater.patch create mode 100644 patches/server/0022-Fix-updater.patch diff --git a/patches/server/0022-Attempt-to-fix-updater.patch b/patches/server/0022-Attempt-to-fix-updater.patch deleted file mode 100644 index 1541c18..0000000 --- a/patches/server/0022-Attempt-to-fix-updater.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Telesphoreo -Date: Tue, 19 Apr 2022 19:35:31 -0500 -Subject: [PATCH] Attempt to fix updater - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java -index 153c06bc00c4619012e77cb496ac57a7f2fc9409..d8ae4145c3a69359788103afa184b08c691fa454 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java -+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java -@@ -35,7 +35,7 @@ public class PaperVersionFetcher implements VersionFetcher { - @Override - public Component getVersionMessage(@Nonnull String serverVersion) { - String[] parts = serverVersion.substring("git-Scissors-".length()).split("[-\\s]"); -- final Component updateMessage = getUpdateStatusMessage("AtlasMediaGroup/Scissors", GITHUB_BRANCH_NAME, parts[0]); -+ final Component updateMessage = getUpdateStatusMessage("AtlasMediaGroup/Scissors", GITHUB_BRANCH_NAME); - final Component history = getHistory(); - - return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage; -@@ -69,11 +69,10 @@ public class PaperVersionFetcher implements VersionFetcher { - } - // Scissors end - -- private static Component getUpdateStatusMessage(@Nonnull String repo, @Nonnull String branch, @Nonnull String versionInfo) { -- int distance; -+ // Scissors - remove versionInfo from paramters -+ private static Component getUpdateStatusMessage(@Nonnull String repo, @Nonnull String branch) { - // Scissors start - always use Git for version checking -- versionInfo = getCommit(); -- distance = fetchDistanceFromGitHub(repo, branch, versionInfo); -+ int distance = fetchDistanceFromGitHub(repo, branch, getMinecraftVersion()); - // Scissors end - - switch (distance) { diff --git a/patches/server/0022-Fix-updater.patch b/patches/server/0022-Fix-updater.patch new file mode 100644 index 0000000..69529a2 --- /dev/null +++ b/patches/server/0022-Fix-updater.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Telesphoreo +Date: Tue, 19 Apr 2022 20:08:56 -0500 +Subject: [PATCH] Fix updater + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java +index 153c06bc00c4619012e77cb496ac57a7f2fc9409..400103cc5cfd6d796e1f2b1ab18e98aea2a0f858 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java ++++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java +@@ -22,7 +22,8 @@ import org.bukkit.Bukkit; + + 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 = getBranch(); ++ // Scissors - This must be changed manually for update checking to work ++ private static final String GITHUB_BRANCH_NAME = "ver/1.18.2"; + private static final String DOWNLOAD_PAGE = "https://ci.plex.us.org/job/Scissors/job/" + GITHUB_BRANCH_NAME; + private static @Nullable String mcVer; + +@@ -62,11 +63,6 @@ public class PaperVersionFetcher implements VersionFetcher { + final var manifest = JarManifests.manifest(Bukkit.getServer().getClass()); + return manifest == null ? null : manifest.getMainAttributes().getValue("Git-Commit"); + } +- +- private static String getBranch() { +- final var manifest = JarManifests.manifest(Bukkit.getServer().getClass()); +- return manifest == null ? null : manifest.getMainAttributes().getValue("Git-Branch"); +- } + // Scissors end + + private static Component getUpdateStatusMessage(@Nonnull String repo, @Nonnull String branch, @Nonnull String versionInfo) {