mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-22 02:47:43 +01:00
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:
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/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[] {})
|
||||
.describedAs("Jar file");
|
||||
|
||||
@@ -15,12 +15,3 @@
|
||||
this.accepts("server-name", "Name of the server")
|
||||
.withRequiredArg()
|
||||
.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();
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user