Yatopia/patches/server/0002-Brandings.patch
Simon Gardling e01705826c
Upstream (#484)
* Updated Upstream and Sidestream(s) (Paper/Purpur/Empirecraft)

Upstream/An Sidestream has released updates that appears to apply and compile correctly
This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing.

Paper Changes:
2a67a9e51 Fix missing CraftMetaBook#toBuilder override
48aa06106 Add more Wandering Trader API (#5020)
8cec462a5 [CI-SKIP] Remove Astei from the MIT list (#5577)
21fbc3196 [CI-SKIP] Add Other textarea to issue templates (#5562)
453e983e4 fix isProxyOnlineMode coverage, don't lookup UUIDs in offline mode (Fixes #2011)
81cc4f928 Send empty commands if tab completion is disabled (Closes #5519)
9ed3e470d Keep moveToWorld with old method signature
99a66a583 [Auto] Updated Upstream (CraftBukkit)
976c6d425 [CI-SKIP] [Auto] Rebuild Patches
51deec726 Drop unneeded portal patch (#5566)
07a18c457 [Auto] Updated Upstream (CraftBukkit)
6733d7875 [Auto] Updated Upstream (Bukkit)
9958447cb [Auto] Updated Upstream (Bukkit)
840e72091 [CI-SKIP] [Auto] Rebuild Patches
a33232d4a Add beacon activation and deactivation events (#5121)

Purpur Changes:
ebc0765 Updated Upstream (Paper)
5bc5dfd Fix #318 - Stonecutter does not damage when sneaking
8366582 Resolve #286 - Add config and API for item immunity to lightning
a86555b Updated Upstream (Paper)
8b2607c Config for only sending advancements to affected players (#312)
7ee3393 Add config for the piston push limit (#311)
a30e5ac Add config for void damage dealt
786382b Updated Upstream (Paper)
60d8411 [ci-skip] fix patch name
b64f536 Config for changing the blocks that turn into paths (#303)
1d3f710 Updated Upstream (Paper)
3af86ad Oopsie
4b0342a Gamemode extra permissions
17c8573 [CI-SKIP] Don't pass ping to demo command output
c3481c0 Initialize the credits command output in config
a176fe6 Add credits command

Empirecraft Changes:
b2879a24 Updated Paper

* Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Empirecraft)

Upstream/An Sidestream has released updates that appears to apply and compile correctly
This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing.

Paper Changes:
b3cc88799 Add the ability to clear entities from block storage (#5598)
f50171f3b Add missing rarity method on ItemStack (#5594)
aeb6e7dd2 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5601)
b0a4f353b fix cancelling block falling causing client desync (fixes #5386) (#5419)
8ed45920c Don't annotate type parameters using JetBrains annotations (#5600)
d7625d926 Add new methods from PlayerMoveEvent to EntityMoveEvent (#5591)
29785297b Allow for Component suggestion tooltips in AsyncTabCompleteEvent (#5504)
0aea6c2ff Use JsonSerializationContext#serialize instead of recursion for AdventureComponents - fixes #5580 and #5371
8fcef3c1f Return after sending empty commands (#5586)

Tuinity Changes:
3350246 Updated Upstream (Paper)
f773caf Fix rare ticket level recursion crash
0fa8a0e Starlight Handle concurrent chunk generation and lighting better

Airplane Changes:
fad74c2 Fix JB annotations for gradle (credit jpenilla)
d02f034 Updated Upstream (Tuinity)

Purpur Changes:
adfe5d3 Updated Upstream (Paper)
7a728f8 Fix #325 - Fix SPIGOT-6278
f5c3dae Updated Upstream (Paper)
a80e5b6 Dont create item meta when checking if meta properties exist
90339c5 Add missing netherite from Material#isArmor
bedac18 Updated Upstream (Paper, Tuinity, & Airplane)
3b1531a [ci-skip] Add wrapper validation step to actions
73ab4e6 Update the "changing the blocks that turn into paths" defaults to reflect the vanilla defaults. (#322)
a24b31b Updated Upstream (Paper)

Empirecraft Changes:
87ceb204 Updated Paper
a3497a7e Fix some patches
2ed9e7fa Updated Paper
d5a47a3d Updated Paper

* Updated Upstream and Sidestream(s) (Tuinity)

Upstream/An Sidestream has released updates that appears to apply and compile correctly
This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing.

Tuinity Changes:
1382473 Null check chunk in block changes for Starlight
2021-05-10 23:16:50 -04:00

273 lines
17 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: YatopiaMC <yatopiamc@gmail.com>
Date: Wed, 26 Feb 2020 18:37:34 +0100
Subject: [PATCH] Brandings
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
index 4d8740678049aa749b42618470e9cc838555528d..159f72efe20f8fee940bd00ae7af00f026f51b1a 100644
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
@@ -593,7 +593,7 @@ public class Metrics {
boolean logFailedRequests = config.getBoolean("logFailedRequests", false);
// Only start Metrics, if it's enabled in the config
if (config.getBoolean("enabled", true)) {
- Metrics metrics = new Metrics("Purpur", serverUUID, logFailedRequests, Bukkit.getLogger()); // Purpur
+ Metrics metrics = new Metrics("Yatopia", serverUUID, logFailedRequests, Bukkit.getLogger()); // Purpur // Yatopia
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
String minecraftVersion = Bukkit.getVersion();
@@ -603,7 +603,7 @@ public class Metrics {
metrics.addCustomChart(new Metrics.SingleLineChart("players", () -> Bukkit.getOnlinePlayers().size()));
metrics.addCustomChart(new Metrics.SimplePie("online_mode", () -> Bukkit.getOnlineMode() ? "online" : (PaperConfig.isProxyOnlineMode() ? "bungee" : "offline"))); // Purpur
- metrics.addCustomChart(new Metrics.SimplePie("purpur_version", () -> (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown")); // Purpur
+ metrics.addCustomChart(new Metrics.SimplePie("yatopia_version", () -> (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown")); // Purpur // Yatopia
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
Map<String, Map<String, Integer>> map = new HashMap<>();
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
index e56ebeaaa12494817d31099eed54ef2c50b98b9e..eb0509386feb156ae9c8ca0eb25c0120c9332b19 100644
--- a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
@@ -19,7 +19,7 @@ public final class PaperConsole extends SimpleTerminalConsole {
@Override
protected LineReader buildReader(LineReaderBuilder builder) {
builder
- .appName("Purpur") // Purpur
+ .appName("Yatopia") // Yatopia
.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/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index 7e8654e4df61527f33d4fce2afdb14e29b90a4c2..a20f8edb8efe6ac3cc6aea1dc791145348bfce8a 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -185,7 +185,7 @@ public class PurpurConfig {
if (!TimingsManager.hiddenConfigs.contains("settings.seed.end-spike")) TimingsManager.hiddenConfigs.add("settings.seed.end-spike");
}
- public static String serverModName = "Purpur";
+ public static String serverModName = "Yatopia";
private static void serverModName() {
serverModName = getString("settings.server-mod-name", serverModName);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index da33704efcce38a6c335adec0564cf7f826aa701..411a8d2ded345fd544b26d3ae86e871edcf7d891 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -232,7 +232,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server {
- private final String serverName = "Purpur"; // Paper // Tuinity // Airplane // Purpur
+ private final String serverName = "Yatopia"; // Paper // Tuinity // Airplane // Purpur // Yatopia
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/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 17d0d0ec4e22ed8b344a2208925a2e9cba5dd58c..73d2287cc4b45b440612b863cea0ca5067e99ed9 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -276,7 +276,7 @@ public class Main {
if (buildDate.before(deadline.getTime())) {
// Paper start - This is some stupid bullshit
System.err.println("*** Warning, you've not updated in a while! ***");
- System.err.println("*** Please download a new build ***"); // Paper // Tuinity
+ System.err.println("*** Please download a new build as per instructions from https://yatopiamc.org/download ***"); // Paper // Tuinity // Yatopia
//System.err.println("*** Server will start in 20 seconds ***");
//Thread.sleep(TimeUnit.SECONDS.toMillis(20));
// Paper End
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index b05b6e911026b8b8ad2e12b7a6705364ec90769d..b6fadc977dfccd60c2e260afa1ae692f809594f0 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -397,7 +397,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@Override
public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
- return new net.pl3x.purpur.PurpurVersionFetcher();
+ return new org.yatopiamc.yatopia.server.YatopiaVersionFetcher(); // Yatopia
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 191f5331f0c7871f80f0da9cc38345ce33353577..4776d0f496fb2ed492545ffb53ecf05e79ae2afb 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
@@ -11,7 +11,7 @@ public final class Versioning {
public static String getBukkitVersion() {
String result = "Unknown-Version";
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/net.pl3x.purpur/purpur-api/pom.properties"); // Tuinity // Airplane // Purpur
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.yatopiamc/yatopia-api/pom.properties"); // Tuinity // Airplane // Purpur // Yatopia
Properties properties = new Properties();
if (stream != null) {
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index 00c728704a1a7aa8b3a2e7679eaa0d2f604da087..1b92b3d2c696fa4ef86a2d2a58eeb447bb3d2739 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -26,7 +26,7 @@ public class WatchdogThread extends Thread
private WatchdogThread(long timeoutTime, boolean restart)
{
- super( "Paper Watchdog Thread" );
+ super( "Yatopia Watchdog Thread" ); // Yatopia
this.timeoutTime = timeoutTime;
this.restart = restart;
earlyWarningEvery = Math.min(PaperConfig.watchdogPrintEarlyWarningEvery, timeoutTime); // Paper
@@ -156,14 +156,14 @@ public class WatchdogThread extends Thread
if (isLongTimeout) {
// Paper end
log.log( Level.SEVERE, "------------------------------" );
- log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Paper bug." ); // Paper
+ log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Yatopia bug." ); // Paper // Yatopia
log.log( Level.SEVERE, "If you see a plugin in the Server thread dump below, then please report it to that author" );
log.log( Level.SEVERE, "\t *Especially* if it looks like HTTP or MySQL operations are occurring" );
log.log( Level.SEVERE, "If you see a world save or edit, then it means you did far more than your server can handle at once" );
log.log( Level.SEVERE, "\t If this is the case, consider increasing timeout-time in spigot.yml but note that this will replace the crash with LARGE lag spikes" );
- log.log( Level.SEVERE, "If you are unsure or still think this is a Paper bug, please report this to https://github.com/PaperMC/Paper/issues" );
+ log.log( Level.SEVERE, "If you are unsure or still think this is a Yatopia bug, please report this to https://github.com/YatopiaMC/Yatopia/issues" ); // Yatopia
log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" );
- log.log( Level.SEVERE, "Paper version: " + Bukkit.getServer().getVersion() );
+ log.log( Level.SEVERE, "Yatopia version: " + Bukkit.getServer().getVersion() ); // Yatopia
//
if ( net.minecraft.world.level.World.lastPhysicsProblem != null )
{
@@ -186,12 +186,12 @@ public class WatchdogThread extends Thread
// Paper end
} else
{
- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---");
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO YATOPIA - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---"); // Yatopia
log.log(Level.SEVERE, "The server has not responded for " + (currentTime - lastTick) / 1000 + " seconds! Creating thread dump");
}
// Paper end - Different message for short timeout
log.log( Level.SEVERE, "------------------------------" );
- log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); // Paper
+ log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Yatopia!):" ); // Paper // Yatopia
ChunkTaskManager.dumpAllChunkLoadInfo(); // Paper
this.dumpTickingInfo(); // Tuinity - log detailed tick information
dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( server.serverThread.getId(), Integer.MAX_VALUE ), log );
@@ -207,7 +207,7 @@ public class WatchdogThread extends Thread
dumpThread( thread, log );
}
} else {
- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH ---");
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO YATOPIA - THIS IS NOT A BUG OR A CRASH ---"); // Yatopia
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurVersionFetcher.java b/src/main/java/org/yatopiamc/yatopia/server/YatopiaVersionFetcher.java
similarity index 72%
rename from src/main/java/net/pl3x/purpur/PurpurVersionFetcher.java
rename to src/main/java/org/yatopiamc/yatopia/server/YatopiaVersionFetcher.java
index cabfcebf9f944f7a2a2a1cffc7401435803a8741..68212b9bdb9c7faf43f3783a84071da5303d78a9 100644
--- a/src/main/java/net/pl3x/purpur/PurpurVersionFetcher.java
+++ b/src/main/java/org/yatopiamc/yatopia/server/YatopiaVersionFetcher.java
@@ -1,7 +1,6 @@
-package net.pl3x.purpur;
+package org.yatopiamc.yatopia.server;
import com.destroystokyo.paper.VersionHistoryManager;
-import com.destroystokyo.paper.util.VersionFetcher;
import com.google.common.base.Charsets;
import com.google.common.io.Resources;
import com.google.gson.Gson;
@@ -12,41 +11,51 @@ import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextDecoration;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import java.io.BufferedReader;
import java.io.IOException;
+import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
+import java.net.URLEncoder;
+import java.util.Arrays;
+import java.util.Objects;
+import java.util.jar.Manifest;
+import javax.annotation.Nonnull;
+
+import com.destroystokyo.paper.util.VersionFetcher;
+import javax.annotation.Nullable;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.TextComponent;
+import net.kyori.adventure.text.format.TextDecoration;
-public class PurpurVersionFetcher implements VersionFetcher {
- private static final String JENKINS_URL = "https://ci.pl3x.net/job/Purpur/lastSuccessfulBuild/buildNumber";
- private static final String GITHUB_BRANCH_NAME = "master";
+public class YatopiaVersionFetcher implements VersionFetcher {
@Override
public long getCacheTime() {
- return 720000;
+ return 3600000;
}
@Nonnull
@Override
public Component getVersionMessage(@Nonnull String serverVersion) {
- String[] parts = serverVersion.substring("git-Purpur-".length()).split("[-\\s]");
- final Component updateMessage = getUpdateStatusMessage("pl3xgaming/Purpur", GITHUB_BRANCH_NAME, parts[0]);
+ if (serverVersion.equals("null")) return Component.text("Custom build");
+ String[] parts = serverVersion.substring("git-Yatopia-".length()).split("[-\\s]");
+ String branch = String.join("-", Arrays.copyOfRange(parts, 0, parts.length - 3));
+ String version = parts[parts.length - 3];
+ final Component updateMessage = getUpdateStatusMessage("YatopiaMC/Yatopia", branch, version);
final Component history = getHistory();
-
- return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
+ return history != null ? TextComponent.ofChildren(history, Component.newline(), updateMessage) : updateMessage;
}
- private static Component getUpdateStatusMessage(@Nonnull String repo, @Nonnull String branch, @Nonnull String versionInfo) {
+ private Component getUpdateStatusMessage(String repo, String branch, String versionInfo) {
int distance;
try {
int jenkinsBuild = Integer.parseInt(versionInfo);
- distance = fetchDistanceFromJenkins(jenkinsBuild);
+ distance = fetchDistanceFromJenkins(branch, jenkinsBuild);
} catch (NumberFormatException ignored) {
- versionInfo = versionInfo.replace("\"", "");
- distance = fetchDistanceFromGitHub(repo, branch, versionInfo);
+ distance = fetchDistanceFromGitHub(repo, branch, versionInfo.replace("\"", ""));
}
switch (distance) {
@@ -61,9 +70,10 @@ public class PurpurVersionFetcher implements VersionFetcher {
}
}
- private static int fetchDistanceFromJenkins(int jenkinsBuild) {
+ // modified from PurpurVersionFetcher
+ private static int fetchDistanceFromJenkins(String branch, int jenkinsBuild) {
try {
- try (BufferedReader reader = Resources.asCharSource(new URL(JENKINS_URL), Charsets.UTF_8).openBufferedStream()) {
+ try (BufferedReader reader = Resources.asCharSource(new URL("https://ci.codemc.io/job/YatopiaMC/job/Yatopia/job/" + URLEncoder.encode(branch, Charsets.UTF_8.name()) + "/lastStableBuild/buildNumber"), Charsets.UTF_8).openBufferedStream()) {
return Integer.decode(reader.readLine()) - jenkinsBuild;
} catch (NumberFormatException ex) {
ex.printStackTrace();
@@ -76,6 +86,7 @@ public class PurpurVersionFetcher implements VersionFetcher {
}
// Contributed by Techcable <Techcable@outlook.com> in GH-65
+ // from PaperVersionFetcher
private static int fetchDistanceFromGitHub(@Nonnull String repo, @Nonnull String branch, @Nonnull String hash) {
try {
HttpURLConnection connection = (HttpURLConnection) new URL("https://api.github.com/repos/" + repo + "/compare/" + branch + "..." + hash).openConnection();
@@ -102,6 +113,7 @@ public class PurpurVersionFetcher implements VersionFetcher {
}
}
+ // from PaperVersionFetcher
@Nullable
private Component getHistory() {
final VersionHistoryManager.VersionData data = VersionHistoryManager.INSTANCE.getVersionData();