From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Fri, 22 Apr 2022 01:27:54 -0500 Subject: [PATCH] Update for 1.18.2 diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java index f92610edcfb724374c69e66443eab60919ee955a..69cc277e4b737ff5a7424cd9afc5573e6eaec3d3 100644 --- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java +++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java @@ -18,6 +18,7 @@ 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 { 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 @@ -56,15 +57,14 @@ public class PaperVersionFetcher implements VersionFetcher { return mcVer; } - // Scissors start - Allow getting git information - public static String getCommit() { - Map attributes = JarManifests.MANIFEST_MAP; - return attributes.get("Git-Commit"); + // Scissors start - Allow getting Git information + private static String getCommit() { + final var manifest = JarManifests.manifest(Bukkit.getServer().getClass()); + return manifest == null ? null : manifest.getMainAttributes().getValue("Git-Commit"); } - - public static String getBranch() { - Map attributes = JarManifests.MANIFEST_MAP; - return attributes.get("Git-Branch"); + private static String getBranch() { + final var manifest = JarManifests.manifest(Bukkit.getServer().getClass()); + return manifest == null ? null : manifest.getMainAttributes().getValue("Git-Branch"); } // Scissors end diff --git a/src/main/java/net/minecraft/network/chat/NbtComponent.java b/src/main/java/net/minecraft/network/chat/NbtComponent.java index f518e47818a47be0dfd7cccc4845ba9736c6cd8b..218525ba1742d68cde10f6caf09ee30eb2d01d50 100644 --- a/src/main/java/net/minecraft/network/chat/NbtComponent.java +++ b/src/main/java/net/minecraft/network/chat/NbtComponent.java @@ -96,6 +96,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); }).orElseGet(() -> { return new TextComponent("");