Updated Upstream (Paper)

Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@8f736dbf Improve outdated version check (#12589)
PaperMC/Paper@3ebc5b33 Don't apply oversized sanitizers in components disabled by config (#13466)
This commit is contained in:
granny
2026-01-03 18:30:46 -08:00
parent 631e6e7e13
commit 56a7d46279
9 changed files with 188 additions and 101 deletions

View File

@@ -2,8 +2,8 @@ group = org.purpurmc.purpur
version = 1.21.11-R0.1-SNAPSHOT version = 1.21.11-R0.1-SNAPSHOT
mcVersion = 1.21.11 mcVersion = 1.21.11
apiVersion=1.21.11 apiVersion = 1.21.11
paperCommit = cd445fdb26d7b159f5c2726acee5db113a3bbff9 paperCommit = 3ebc5b3320924e9122903dfd1f11abcf897300e6
org.gradle.configuration-cache = true org.gradle.configuration-cache = true
org.gradle.caching = true org.gradle.caching = true

View File

@@ -18,10 +18,10 @@ index 05eb0c3273ffa1b5a1ebd8f8ae42c11830d755c7..49d3154afe2ca5789e63bdf972c79196
public boolean isClientAuthoritative() { public boolean isClientAuthoritative() {
return false; return false;
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 3b773fc2a357811cb63f48b0ae351efbcd3878b0..5acc46e0d16c365d67c14d0c2bfc4346d4f46f21 100644 index 2e7dd34a7ba74b6545ccc92ba109def077c2618f..e842e82e8915f8e0d95013f7f731914202dc6b7b 100644
--- a/net/minecraft/server/MinecraftServer.java --- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java
@@ -1833,6 +1833,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1838,6 +1838,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
serverLevel.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent serverLevel.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
serverLevel.updateLagCompensationTick(); // Paper - lag compensation serverLevel.updateLagCompensationTick(); // Paper - lag compensation
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = serverLevel.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = serverLevel.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Setting to reintroduce end void rings
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index cfd9596246713030f7c0f28a65abeed6dcc8d81b..952444a26fd13ae0b385b2b7f717d965b4c76d19 100644 index e842e82e8915f8e0d95013f7f731914202dc6b7b..fc56c5cace242821b8d40847e01081ee41c61ef6 100644
--- a/net/minecraft/server/MinecraftServer.java --- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java
@@ -1315,6 +1315,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1320,6 +1320,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
} }
// Purpur end - config for startup commands // Purpur end - config for startup commands

View File

@@ -50,9 +50,15 @@
this.isRestarting = isRestarting; this.isRestarting = isRestarting;
this.hasLoggedStop = true; // Paper - Debugging this.hasLoggedStop = true; // Paper - Debugging
if (isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper - Debugging if (isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper - Debugging
@@ -1291,6 +_,16 @@ @@ -1291,11 +_,21 @@
} }
// Paper end - Add onboarding message for initial server start // Paper end - Add onboarding message for initial server start
// Paper start - Improve outdated version checking
- if (System.getProperty("paper.disableStartupVersionCheck") == null && io.papermc.paper.configuration.GlobalConfiguration.get().updateChecker.enabled) {
+ if (false && System.getProperty("paper.disableStartupVersionCheck") == null && io.papermc.paper.configuration.GlobalConfiguration.get().updateChecker.enabled) { // Purpur - disable paper startup check
CompletableFuture.runAsync(com.destroystokyo.paper.PaperVersionFetcher::getUpdateStatusStartupMessage, io.papermc.paper.util.MCUtil.ASYNC_EXECUTOR);
}
// Paper end - Improve outdated version checking
+ // Purpur start - config for startup commands + // Purpur start - config for startup commands
+ if (!Boolean.getBoolean("Purpur.IReallyDontWantStartupCommands") && !org.purpurmc.purpur.PurpurConfig.startupCommands.isEmpty()) { + if (!Boolean.getBoolean("Purpur.IReallyDontWantStartupCommands") && !org.purpurmc.purpur.PurpurConfig.startupCommands.isEmpty()) {
@@ -67,7 +73,7 @@
while (this.running) { while (this.running) {
final long tickStart = System.nanoTime(); // Paper - improve tick loop final long tickStart = System.nanoTime(); // Paper - improve tick loop
long l; // Paper - improve tick loop - diff on change, expect this to be tick interval long l; // Paper - improve tick loop - diff on change, expect this to be tick interval
@@ -1304,8 +_,10 @@ @@ -1309,8 +_,10 @@
final long ticksBehind = Math.max(1L, this.tickSchedule.getPeriodsAhead(l, tickStart)); final long ticksBehind = Math.max(1L, this.tickSchedule.getPeriodsAhead(l, tickStart));
final long catchup = (long)Math.max( final long catchup = (long)Math.max(
1, 1,
@@ -79,7 +85,7 @@
// adjust ticksBehind so that it is not greater-than catchup // adjust ticksBehind so that it is not greater-than catchup
if (ticksBehind > catchup) { if (ticksBehind > catchup) {
@@ -1787,7 +_,7 @@ @@ -1792,7 +_,7 @@
long worldTime = level.getGameTime(); long worldTime = level.getGameTime();
final ClientboundSetTimePacket worldPacket = new ClientboundSetTimePacket(worldTime, dayTime, doDaylight); final ClientboundSetTimePacket worldPacket = new ClientboundSetTimePacket(worldTime, dayTime, doDaylight);
for (Player entityhuman : level.players()) { for (Player entityhuman : level.players()) {
@@ -88,7 +94,7 @@
continue; continue;
} }
ServerPlayer entityplayer = (ServerPlayer) entityhuman; ServerPlayer entityplayer = (ServerPlayer) entityhuman;
@@ -1954,7 +_,7 @@ @@ -1959,7 +_,7 @@
@DontObfuscate @DontObfuscate
public String getServerModName() { public String getServerModName() {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Setting to reintroduce end void rings
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index c52d2530f6bfd601e8af8fd6713e6870cf5611d3..c95bca1a3100952fb02a7bff46fcf9155b185a80 100644 index e47f279b66b169e2cdf762bb739a261f2acebeb1..cc1906ef871de6a4ff82039d8ddfcd764139f37d 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -300,6 +300,7 @@ public class GlobalConfiguration extends ConfigurationPart { @@ -303,6 +303,7 @@ public class GlobalConfiguration extends ConfigurationPart {
} }
} }
@@ -16,7 +16,7 @@ index c52d2530f6bfd601e8af8fd6713e6870cf5611d3..c95bca1a3100952fb02a7bff46fcf915
public Misc misc; public Misc misc;
public class Misc extends ConfigurationPart { public class Misc extends ConfigurationPart {
@@ -346,6 +347,7 @@ public class GlobalConfiguration extends ConfigurationPart { @@ -349,6 +350,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@Comment("Whether the nether dimension is enabled and will be loaded.") @Comment("Whether the nether dimension is enabled and will be loaded.")
public boolean enableNether = true; public boolean enableNether = true;
@Comment("Keeps Paper's fix for MC-159283 enabled. Disable to use vanilla End ring terrain.") @Comment("Keeps Paper's fix for MC-159283 enabled. Disable to use vanilla End ring terrain.")

View File

@@ -1,78 +0,0 @@
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
@@ -35,7 +_,10 @@
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 - Rebrand
+ private static final String DOWNLOAD_PAGE = "https://purpurmc.org/downloads";
+ private static int distance = DISTANCE_UNKNOWN; public int distance() { return distance; }
+ // Purpur end - Rebrand
@Override
public long getCacheTime() {
@@ -49,7 +_,7 @@
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 - Rebrand
}
final @Nullable Component history = this.getHistory();
@@ -57,7 +_,7 @@
}
private static Component getUpdateStatusMessage(final String repo, final ServerBuildInfo build) {
- int distance = DISTANCE_ERROR;
+ //int distance = DISTANCE_ERROR; // Purpur - use field - Rebrand
final OptionalInt buildNumber = build.buildNumber();
if (buildNumber.isPresent()) {
@@ -71,10 +_,10 @@
}
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 - Rebrand
+ case 0 -> text("* You are running the latest version", NamedTextColor.GREEN); // Purpur - Rebrand
+ case DISTANCE_UNKNOWN -> text("* Unknown version", NamedTextColor.YELLOW); // Purpur - Rebrand
+ default -> text("* You are " + distance + " version(s) behind", NamedTextColor.YELLOW) // Purpur - Rebrand
.append(Component.newline())
.append(text("Download the new version at: ")
.append(text(DOWNLOAD_PAGE, NamedTextColor.GOLD)
@@ -86,18 +_,15 @@
private static int fetchDistanceFromSiteApi(final ServerBuildInfo build, final int jenkinsBuild) {
try {
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 - Rebrand
StandardCharsets.UTF_8
).openBufferedStream()) {
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()
- .orElseThrow();
+ //final JsonArray builds = json.getAsJsonArray("builds"); // Purpur - Rebrand
+ final int latest = json.getAsJsonObject("builds").getAsJsonPrimitive("latest").getAsInt(); // Purpur - Rebrand
return latest - jenkinsBuild;
} catch (final JsonSyntaxException ex) {
- LOGGER.error("Error parsing json from Paper's downloads API", ex);
+ LOGGER.error("Error parsing json from Purpur's downloads API", ex); // Purpur - Rebrand
return DISTANCE_ERROR;
}
} catch (final IOException e) {
@@ -141,6 +_,6 @@
return null;
}
- return text("Previous version: " + oldVersion, NamedTextColor.GRAY, TextDecoration.ITALIC);
+ return text("Previous: " + oldVersion, NamedTextColor.GRAY); // Purpur - Rebrand
}
}

View File

@@ -1,6 +1,6 @@
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -164,6 +_,14 @@ @@ -162,6 +_,14 @@
.defaultsTo(new File[] {}) .defaultsTo(new File[] {})
.describedAs("Jar file"); .describedAs("Jar file");
@@ -15,12 +15,3 @@
this.accepts("server-name", "Name of the server") this.accepts("server-name", "Name of the server")
.withRequiredArg() .withRequiredArg()
.ofType(String.class) .ofType(String.class)
@@ -223,7 +_,7 @@
System.setProperty(net.minecrell.terminalconsole.TerminalConsoleAppender.JLINE_OVERRIDE_PROPERTY, "false"); // Paper
}
- if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
+ if (false && Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { // Purpur - Disable outdated build check
Date buildDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(Main.class.getPackage().getImplementationVendor()); // Paper
Calendar deadline = Calendar.getInstance();

View File

@@ -0,0 +1,11 @@
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -487,7 +_,7 @@
@Override
public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
- return new com.destroystokyo.paper.PaperVersionFetcher();
+ return new org.purpurmc.purpur.PurpurVersionFetcher(); // Purpur - use old Paper version checker
}
@Override

View File

@@ -0,0 +1,157 @@
package org.purpurmc.purpur;
import com.destroystokyo.paper.VersionHistoryManager;
import com.destroystokyo.paper.util.VersionFetcher;
import com.google.common.io.Resources;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException;
import com.mojang.logging.LogUtils;
import io.papermc.paper.ServerBuildInfo;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.Optional;
import java.util.OptionalInt;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.format.NamedTextColor;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.framework.qual.DefaultQualifier;
import org.slf4j.Logger;
import static net.kyori.adventure.text.Component.text;
import static net.kyori.adventure.text.format.TextColor.color;
import static io.papermc.paper.ServerBuildInfo.StringRepresentation.VERSION_SIMPLE;
/**
* Modified version of Paper's Version Fetcher before Fill API implementation.
*/
@DefaultQualifier(NonNull.class)
public class PurpurVersionFetcher 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://purpurmc.org/downloads";
private static final String REPOSITORY = "PurpurMC/Purpur";
private static final ServerBuildInfo BUILD_INFO;
private static final String USER_AGENT;
private static final Gson GSON = new Gson();
static {
BUILD_INFO = ServerBuildInfo.buildInfo();
USER_AGENT = BUILD_INFO.brandName() + "/" + BUILD_INFO.asString(VERSION_SIMPLE) + " (https://purpurmc.org)";
}
private static int distance = DISTANCE_UNKNOWN;
public int distance() {
return distance;
}
@Override
public long getCacheTime() {
return 720000;
}
@Override
public Component getVersionMessage() {
final Component updateMessage;
if (BUILD_INFO.buildNumber().isEmpty() && BUILD_INFO.gitCommit().isEmpty()) {
updateMessage = text("You are running a development version without access to version information", color(0xFF5300));
} else {
updateMessage = getUpdateStatusMessage();
}
final @Nullable Component history = this.getHistory();
return history != null ? Component.textOfChildren(updateMessage, Component.newline(), history) : updateMessage;
}
private static Component getUpdateStatusMessage() {
final OptionalInt buildNumber = BUILD_INFO.buildNumber();
if (buildNumber.isPresent()) {
distance = fetchDistanceFromSiteApi(buildNumber.getAsInt());
} else {
final Optional<String> gitBranch = BUILD_INFO.gitBranch();
final Optional<String> gitCommit = BUILD_INFO.gitCommit();
if (gitBranch.isPresent() && gitCommit.isPresent()) {
distance = fetchDistanceFromGitHub(gitBranch.get(), gitCommit.get());
}
}
return switch (distance) {
case DISTANCE_ERROR -> text("* Error obtaining version information", NamedTextColor.RED);
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)
.append(Component.newline())
.append(text("Download the new version at: ")
.append(text(DOWNLOAD_PAGE, NamedTextColor.GOLD)
.hoverEvent(text("Click to open", NamedTextColor.WHITE))
.clickEvent(ClickEvent.openUrl(DOWNLOAD_PAGE))));
};
}
private static int fetchDistanceFromSiteApi(final int jenkinsBuild) {
try {
try (final BufferedReader reader = Resources.asCharSource(
URI.create("https://api.purpurmc.org/v2/purpur/" + BUILD_INFO.minecraftVersionId()).toURL(),
StandardCharsets.UTF_8
).openBufferedStream()) {
final JsonObject json = new Gson().fromJson(reader, JsonObject.class);
final int latest = json.getAsJsonObject("builds").getAsJsonPrimitive("latest").getAsInt();
return latest - jenkinsBuild;
} catch (final JsonSyntaxException ex) {
LOGGER.error("Error parsing json from Purpur's downloads API", ex);
return DISTANCE_ERROR;
}
} catch (final IOException e) {
LOGGER.error("Error while parsing version", e);
return DISTANCE_ERROR;
}
}
// Contributed by Techcable <Techcable@outlook.com> in PaperMC/Paper GH-65
private static int fetchDistanceFromGitHub(final String branch, final String hash) {
try {
final HttpURLConnection connection = (HttpURLConnection) URI.create("https://api.github.com/repos/%s/compare/%s...%s".formatted(REPOSITORY, branch, hash)).toURL().openConnection();
connection.setConnectTimeout(5000);
connection.setReadTimeout(5000);
connection.setRequestProperty("User-Agent", USER_AGENT);
connection.connect();
if (connection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) return DISTANCE_UNKNOWN; // Unknown commit
try (final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {
final JsonObject obj = GSON.fromJson(reader, JsonObject.class);
final String status = obj.get("status").getAsString();
return switch (status) {
case "identical" -> 0;
case "behind" -> obj.get("behind_by").getAsInt();
default -> DISTANCE_ERROR;
};
} catch (final JsonSyntaxException | NumberFormatException e) {
LOGGER.error("Error parsing json from GitHub's API", e);
return DISTANCE_ERROR;
}
} catch (final IOException e) {
LOGGER.error("Error while parsing version", e);
return DISTANCE_ERROR;
}
}
private @Nullable Component getHistory() {
final VersionHistoryManager.@Nullable VersionData data = VersionHistoryManager.INSTANCE.getVersionData();
if (data == null) {
return null;
}
final @Nullable String oldVersion = data.getOldVersion();
if (oldVersion == null) {
return null;
}
return text("Previous: " + oldVersion, NamedTextColor.GRAY);
}
}