Create 0023-Revert-and-fix-a-few-things.patch

This commit is contained in:
Telesphoreo 2022-04-19 20:02:28 -05:00
parent 1546e4ae5f
commit 719cce7443

View File

@ -0,0 +1,58 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Telesphoreo <me@telesphoreo.me>
Date: Tue, 19 Apr 2022 20:01:29 -0500
Subject: [PATCH] Revert and fix a few things
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
index d8ae4145c3a69359788103afa184b08c691fa454..af6e62144b459a968afeffaa557e5375d8d5588f 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 - note this has to be changed manually. Automatic changing does not seem 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;
@@ -35,7 +36,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);
+ final Component updateMessage = getUpdateStatusMessage("AtlasMediaGroup/Scissors", GITHUB_BRANCH_NAME, parts[0]);
final Component history = getHistory();
return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
@@ -69,10 +70,11 @@ public class PaperVersionFetcher implements VersionFetcher {
}
// Scissors end
- // Scissors - remove versionInfo from paramters
- private static Component getUpdateStatusMessage(@Nonnull String repo, @Nonnull String branch) {
+ private static Component getUpdateStatusMessage(@Nonnull String repo, @Nonnull String branch, @Nonnull String versionInfo) {
+ int distance;
// Scissors start - always use Git for version checking
- int distance = fetchDistanceFromGitHub(repo, branch, getMinecraftVersion());
+ versionInfo = getCommit();
+ distance = fetchDistanceFromGitHub(repo, branch, versionInfo);
// Scissors end
switch (distance) {
diff --git a/src/main/java/net/minecraft/network/chat/NbtComponent.java b/src/main/java/net/minecraft/network/chat/NbtComponent.java
index 8bb0544ef08eb0c221f06ddf96b63be5d02dc5ab..e3dc56de3f91e03b1543257f72448a734d914ed7 100644
--- a/src/main/java/net/minecraft/network/chat/NbtComponent.java
+++ b/src/main/java/net/minecraft/network/chat/NbtComponent.java
@@ -95,8 +95,7 @@ public abstract class NbtComponent extends BaseComponent implements ContextAware
return stream.map((string) -> {
return new TextComponent(string);
}).reduce((accumulator, current) -> {
- // Scissors - untested, likely needs fixing
- return (TextComponent)accumulator.append(text).append(current);
+ return accumulator.append(text).append(current);
}).orElseGet(() -> {
return new TextComponent("");
});