mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 18:07:43 +01:00
Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@3fc9358 Show stacktrace when modifyItemStack fails PaperMC/Paper@f175193 Expose server build information (#10729)
This commit is contained in:
@@ -5,10 +5,10 @@ Subject: [PATCH] Rebrand
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 87bb3fd9b97506f61734ae7f2e6860610ba794e7..89f21e21efc5f5ab99d1586f4f3b8f2f3c48ac06 100644
|
||||
index 4998aff0b7cb084dcda15c6a18bbe45e99b6000a..d23ecfabf6bf1e355fb2efe5abd80236259ce3c4 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -12,7 +12,7 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
|
||||
@@ -13,7 +13,7 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
|
||||
val alsoShade: Configuration by configurations.creating
|
||||
|
||||
dependencies {
|
||||
@@ -17,7 +17,7 @@ index 87bb3fd9b97506f61734ae7f2e6860610ba794e7..89f21e21efc5f5ab99d1586f4f3b8f2f
|
||||
// Paper start
|
||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||
@@ -46,6 +46,10 @@ dependencies {
|
||||
@@ -47,6 +47,10 @@ dependencies {
|
||||
runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18")
|
||||
runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18")
|
||||
|
||||
@@ -28,16 +28,27 @@ index 87bb3fd9b97506f61734ae7f2e6860610ba794e7..89f21e21efc5f5ab99d1586f4f3b8f2f
|
||||
testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
|
||||
testImplementation("org.hamcrest:hamcrest:2.2")
|
||||
@@ -78,7 +82,7 @@ tasks.jar {
|
||||
@@ -80,14 +84,14 @@ tasks.jar {
|
||||
val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
|
||||
attributes(
|
||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||
"Implementation-Title" to "CraftBukkit",
|
||||
- "Implementation-Version" to "git-Paper-$implementationVersion",
|
||||
+ "Implementation-Version" to "git-Purpur-$implementationVersion", // Pufferfish // Purpur
|
||||
- "Implementation-Title" to "Paper",
|
||||
+ "Implementation-Title" to "Purpur", // Purpur
|
||||
"Implementation-Version" to implementationVersion,
|
||||
"Implementation-Vendor" to date, // Paper
|
||||
"Specification-Title" to "Bukkit",
|
||||
- "Specification-Title" to "Paper",
|
||||
+ "Specification-Title" to "Purpur", // Purpur
|
||||
"Specification-Version" to project.version,
|
||||
@@ -137,7 +141,7 @@ fun TaskContainer.registerRunTask(
|
||||
- "Specification-Vendor" to "Paper Team",
|
||||
- "Brand-Id" to "papermc:paper",
|
||||
- "Brand-Name" to "Paper",
|
||||
+ "Specification-Vendor" to "Purpur Team", // Purpur
|
||||
+ "Brand-Id" to "purpurmc:purpur", // Purpur
|
||||
+ "Brand-Name" to "Purpur", // Purpur
|
||||
"Build-Number" to (build ?: ""),
|
||||
"Build-Time" to Instant.now().toString(),
|
||||
"Git-Branch" to gitBranch, // Paper
|
||||
@@ -144,7 +148,7 @@ fun TaskContainer.registerRunTask(
|
||||
name: String,
|
||||
block: JavaExec.() -> Unit
|
||||
): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
||||
@@ -47,97 +58,78 @@ index 87bb3fd9b97506f61734ae7f2e6860610ba794e7..89f21e21efc5f5ab99d1586f4f3b8f2f
|
||||
standardInput = System.`in`
|
||||
workingDir = rootProject.layout.projectDirectory
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
index 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..462a6eed350fd660ddaf25d567bb6e97b77d0b2b 100644
|
||||
index 532306cacd52579cdf37e4aca25887b1ed3ba6a1..af5890e6d915cc60cf19fc531022699599450493 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
@@ -19,8 +19,10 @@ 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";
|
||||
@@ -35,7 +35,10 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
private static final Logger LOGGER = LogUtils.getClassLogger();
|
||||
private static final int DISTANCE_ERROR = -1;
|
||||
private static final int DISTANCE_UNKNOWN = -2;
|
||||
- private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads/paper";
|
||||
+ // Purpur start
|
||||
+ private static final String DOWNLOAD_PAGE = "https://purpurmc.org/downloads";
|
||||
+ private static int distance = -2; public int distance() { return distance; }
|
||||
+ private static int distance = DISTANCE_UNKNOWN; public int distance() { return distance; }
|
||||
+ // Purpur end
|
||||
private static @Nullable String mcVer;
|
||||
|
||||
@Override
|
||||
@@ -31,11 +33,11 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
@Nonnull
|
||||
@Override
|
||||
public Component getVersionMessage(@Nonnull String serverVersion) {
|
||||
- String[] parts = serverVersion.substring("git-Paper-".length()).split("[-\\s]");
|
||||
- final Component updateMessage = getUpdateStatusMessage("PaperMC/Paper", GITHUB_BRANCH_NAME, parts[0]);
|
||||
+ String[] parts = serverVersion.substring("git-Purpur-".length()).split("[-\\s]"); // Purpur
|
||||
+ final Component updateMessage = getUpdateStatusMessage("PurpurMC/Purpur", "ver/" + getMinecraftVersion(), parts[0]); // Purpur
|
||||
final Component history = getHistory();
|
||||
public long getCacheTime() {
|
||||
@@ -49,7 +52,7 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
if (build.buildNumber().isEmpty() && build.gitCommit().isEmpty()) {
|
||||
updateMessage = text("You are running a development version without access to version information", color(0xFF5300));
|
||||
} else {
|
||||
- updateMessage = getUpdateStatusMessage("PaperMC/Paper", build);
|
||||
+ updateMessage = getUpdateStatusMessage("PurpurMC/Purpur", build); // Purpur
|
||||
}
|
||||
final @Nullable Component history = this.getHistory();
|
||||
|
||||
- return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
|
||||
+ return history != null ? Component.join(net.kyori.adventure.text.JoinConfiguration.separator(Component.newline()), history, updateMessage) : updateMessage; // Purpur
|
||||
@@ -57,7 +60,7 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
}
|
||||
|
||||
private static @Nullable String getMinecraftVersion() {
|
||||
@@ -45,7 +47,7 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
String result = matcher.group();
|
||||
mcVer = result.substring(0, result.length() - 2); // strip 'R' anchor and trailing '-'
|
||||
} else {
|
||||
- org.bukkit.Bukkit.getLogger().warning("Unable to match version to pattern! Report to PaperMC!");
|
||||
+ org.bukkit.Bukkit.getLogger().warning("Unable to match version to pattern! Report to Purpur!"); // Purpur
|
||||
org.bukkit.Bukkit.getLogger().warning("Pattern: " + VER_PATTERN.toString());
|
||||
org.bukkit.Bukkit.getLogger().warning("Version: " + org.bukkit.Bukkit.getBukkitVersion());
|
||||
}
|
||||
@@ -55,7 +57,7 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
}
|
||||
private static Component getUpdateStatusMessage(final String repo, final ServerBuildInfo build) {
|
||||
- int distance = DISTANCE_ERROR;
|
||||
+ //int distance = DISTANCE_ERROR; // Purpur - use field
|
||||
|
||||
private static Component getUpdateStatusMessage(@Nonnull String repo, @Nonnull String branch, @Nonnull String versionInfo) {
|
||||
- int distance;
|
||||
+ //int distance; // Purpur - use field
|
||||
try {
|
||||
int jenkinsBuild = Integer.parseInt(versionInfo);
|
||||
distance = fetchDistanceFromSiteApi(jenkinsBuild, getMinecraftVersion());
|
||||
@@ -66,13 +68,13 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
final OptionalInt buildNumber = build.buildNumber();
|
||||
if (buildNumber.isPresent()) {
|
||||
@@ -71,10 +74,10 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
}
|
||||
|
||||
switch (distance) {
|
||||
case -1:
|
||||
- return Component.text("Error obtaining version information", NamedTextColor.YELLOW);
|
||||
+ return Component.text("* Error obtaining version information", NamedTextColor.RED); // Purpur
|
||||
case 0:
|
||||
- return Component.text("You are running the latest version", NamedTextColor.GREEN);
|
||||
+ return Component.text("* You are running the latest version", NamedTextColor.GREEN); // Purpur
|
||||
case -2:
|
||||
- return Component.text("Unknown version", NamedTextColor.YELLOW);
|
||||
+ return Component.text("* Unknown version", NamedTextColor.YELLOW); // Purpur
|
||||
default:
|
||||
- return Component.text("You are " + distance + " version(s) behind", NamedTextColor.YELLOW)
|
||||
+ return Component.text("* You are " + distance + " version(s) behind", NamedTextColor.YELLOW) // Purpur
|
||||
.append(Component.newline())
|
||||
.append(Component.text("Download the new version at: ")
|
||||
.append(Component.text(DOWNLOAD_PAGE, NamedTextColor.GOLD)
|
||||
@@ -85,15 +87,11 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
if (siteApiVersion == null) { return -1; }
|
||||
return switch (distance) {
|
||||
- case DISTANCE_ERROR -> text("Error obtaining version information", NamedTextColor.YELLOW);
|
||||
- case 0 -> text("You are running the latest version", NamedTextColor.GREEN);
|
||||
- case DISTANCE_UNKNOWN -> text("Unknown version", NamedTextColor.YELLOW);
|
||||
- default -> text("You are " + distance + " version(s) behind", NamedTextColor.YELLOW)
|
||||
+ case DISTANCE_ERROR -> text("* Error obtaining version information", NamedTextColor.RED); // Purpur
|
||||
+ case 0 -> text("* You are running the latest version", NamedTextColor.GREEN); // Purpur
|
||||
+ case DISTANCE_UNKNOWN -> text("* Unknown version", NamedTextColor.YELLOW); // Purpur
|
||||
+ default -> text("* You are " + distance + " version(s) behind", NamedTextColor.YELLOW) // Purpur
|
||||
.append(Component.newline())
|
||||
.append(text("Download the new version at: ")
|
||||
.append(text(DOWNLOAD_PAGE, NamedTextColor.GOLD)
|
||||
@@ -86,15 +89,12 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
private static int fetchDistanceFromSiteApi(final ServerBuildInfo build, final int jenkinsBuild) {
|
||||
try {
|
||||
try (BufferedReader reader = Resources.asCharSource(
|
||||
- new URL("https://api.papermc.io/v2/projects/paper/versions/" + siteApiVersion),
|
||||
+ new URL("https://api.purpurmc.org/v2/purpur/" + siteApiVersion), // Purpur
|
||||
try (final BufferedReader reader = Resources.asCharSource(
|
||||
- URI.create("https://api.papermc.io/v2/projects/paper/versions/" + build.minecraftVersionId()).toURL(),
|
||||
+ URI.create("https://api.purpurmc.org/v2/purpur/" + build.minecraftVersionId()).toURL(), // Purpur
|
||||
Charsets.UTF_8
|
||||
).openBufferedStream()) {
|
||||
JsonObject json = new Gson().fromJson(reader, JsonObject.class);
|
||||
- JsonArray builds = json.getAsJsonArray("builds");
|
||||
- int latest = StreamSupport.stream(builds.spliterator(), false)
|
||||
- .mapToInt(e -> e.getAsInt())
|
||||
final JsonObject json = new Gson().fromJson(reader, JsonObject.class);
|
||||
final JsonArray builds = json.getAsJsonArray("builds");
|
||||
- final int latest = StreamSupport.stream(builds.spliterator(), false)
|
||||
- .mapToInt(JsonElement::getAsInt)
|
||||
- .max()
|
||||
- .getAsInt();
|
||||
+ int latest = json.getAsJsonObject("builds").getAsJsonPrimitive("latest").getAsInt(); // Purpur
|
||||
- .orElseThrow();
|
||||
+ final int latest = json.getAsJsonObject("builds").getAsJsonPrimitive("latest").getAsInt(); // Purpur
|
||||
return latest - jenkinsBuild;
|
||||
} catch (JsonSyntaxException ex) {
|
||||
ex.printStackTrace();
|
||||
@@ -144,6 +142,6 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
} catch (final JsonSyntaxException ex) {
|
||||
LOGGER.error("Error parsing json from Paper's downloads API", ex);
|
||||
@@ -141,6 +141,6 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
return null;
|
||||
}
|
||||
|
||||
- return Component.text("Previous version: " + oldVersion, NamedTextColor.GRAY, TextDecoration.ITALIC);
|
||||
+ return org.bukkit.ChatColor.parseMM("<grey>Previous: %s", oldVersion); // Purpur
|
||||
- return text("Previous version: " + oldVersion, NamedTextColor.GRAY, TextDecoration.ITALIC);
|
||||
+ return text("Previous: " + oldVersion, NamedTextColor.GRAY); // Purpur
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||
@@ -153,6 +145,39 @@ index c5d5648f4ca603ef2b1df723b58f9caf4dd3c722..3cb56595822799926a8141e60a42f5d1
|
||||
.variable(LineReader.HISTORY_FILE, java.nio.file.Paths.get(".console_history"))
|
||||
.completer(new ConsoleCommandCompleter(this.server))
|
||||
.option(LineReader.Option.COMPLETE_IN_WORD, true);
|
||||
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
|
||||
index 790bad0494454ca12ee152e3de6da3da634d9b20..a6e5950b5875cafd734300cdfbf58f5d3736f3c8 100644
|
||||
--- a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
|
||||
+++ b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
|
||||
@@ -31,6 +31,7 @@ public record ServerBuildInfoImpl(
|
||||
private static final String ATTRIBUTE_GIT_COMMIT = "Git-Commit";
|
||||
|
||||
private static final String BRAND_PAPER_NAME = "Paper";
|
||||
+ private static final String BRAND_PURPUR_NAME = "Purpur"; // Purpur
|
||||
|
||||
private static final String BUILD_DEV = "DEV";
|
||||
|
||||
@@ -42,9 +43,9 @@ public record ServerBuildInfoImpl(
|
||||
this(
|
||||
getManifestAttribute(manifest, ATTRIBUTE_BRAND_ID)
|
||||
.map(Key::key)
|
||||
- .orElse(BRAND_PAPER_ID),
|
||||
+ .orElse(BRAND_PURPUR_ID), // Purpur
|
||||
getManifestAttribute(manifest, ATTRIBUTE_BRAND_NAME)
|
||||
- .orElse(BRAND_PAPER_NAME),
|
||||
+ .orElse(BRAND_PURPUR_NAME), // Purpur
|
||||
SharedConstants.getCurrentVersion().getId(),
|
||||
SharedConstants.getCurrentVersion().getName(),
|
||||
getManifestAttribute(manifest, ATTRIBUTE_BUILD_NUMBER)
|
||||
@@ -61,7 +62,7 @@ public record ServerBuildInfoImpl(
|
||||
|
||||
@Override
|
||||
public boolean isBrandCompatible(final @NotNull Key brandId) {
|
||||
- return brandId.equals(this.brandId);
|
||||
+ return brandId.equals(this.brandId) || brandId.equals(BRAND_PAPER_ID); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java
|
||||
index 4f3cc14d48690bb183d09bb7a5ba1e23e8a0c08a..c366d84518979e842a6f10f969a5951539ecac93 100644
|
||||
--- a/src/main/java/net/minecraft/CrashReport.java
|
||||
@@ -169,10 +194,10 @@ index 4f3cc14d48690bb183d09bb7a5ba1e23e8a0c08a..c366d84518979e842a6f10f969a59515
|
||||
stringbuilder.append(CrashReport.getErrorComment());
|
||||
stringbuilder.append("\n\n");
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 39303bb4e336732db0ab19dee0c1f8b609bbb134..7483be7ff59e80aa6605dc19f18bb54473e3540e 100644
|
||||
index dbc86b8d4d2af6e5f7e678f2bb77fd39b85c04c5..989de328a8dd26486d65245d2737d9789d936e8a 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -962,7 +962,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -959,7 +959,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
shutdownThread = Thread.currentThread();
|
||||
org.spigotmc.WatchdogThread.doStop(); // Paper
|
||||
if (!isSameThread()) {
|
||||
@@ -181,28 +206,6 @@ index 39303bb4e336732db0ab19dee0c1f8b609bbb134..7483be7ff59e80aa6605dc19f18bb544
|
||||
while (this.getRunningThread().isAlive()) {
|
||||
this.getRunningThread().stop();
|
||||
try {
|
||||
@@ -1926,7 +1926,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
- return "Paper"; // Paper
|
||||
+ return "Purpur"; // Purpur - Purpur > // Pufferfish > // Paper
|
||||
}
|
||||
|
||||
public SystemReport fillSystemReport(SystemReport details) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index da1aed63af837b193900bb85393611edbd56c363..4f454c5d70e7333429557eb86e38e0f2c22af380 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -269,7 +269,7 @@ import javax.annotation.Nullable; // Paper
|
||||
import javax.annotation.Nonnull; // Paper
|
||||
|
||||
public final class CraftServer implements Server {
|
||||
- private final String serverName = "Paper"; // Paper
|
||||
+ private final String serverName = "Purpur"; // Paper // Pufferfish // Purpur
|
||||
private final String serverVersion;
|
||||
private final String bukkitVersion = Versioning.getBukkitVersion();
|
||||
private final Logger logger = Logger.getLogger("Minecraft");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java
|
||||
index 4e56018b64d11f76c8da43fd8f85c6de72204e36..9607675e6c5bff2183c4420d11fc63eeb5747fb6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java
|
||||
@@ -244,7 +247,7 @@ index e85b9bb3f9c225d289a4959921970b9963881199..c1e2d3a75b9d4710ab6d8b5c62af4bc1
|
||||
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 74c5c0e63a3c41174967c1be1da01e60e458f12f..8c62796dacf79dbe7ac228ac04ea478679466fd4 100644
|
||||
index 5a382907285a288f2a223189e690d3dbdf45594c..3daf674f1e0de3fdd89db5536cc1e34140a5abb8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -511,7 +511,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
|
||||
Reference in New Issue
Block a user