mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2025-02-03 22:11:50 +01:00
7f24790a35
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: cf37529 Updated Upstream (Paper) EMC Changes: 27282006 Updated Paper 456edfa4 One more try to fix more chunks on reload Purpur Changes: 45d5e9a Fix dolphin spit and phantom flames 9e1b8e7 Clean up teleport outside border patch Add sleeping, inventory, and toWorld checks 8428580 [ci-skip] Add 'fast' argument to './purpur jar' to speed up jenkins build time cea486c Updated Upstream (Paper) 6cd244c Fix infinite furnaces triggering without lava source a989361 Fix infinite furnaces leaving empty buckets 6cf1672 Add config option for whether Nether Wart farming Villagers should throw extra Nether Warts at other Villagers 07d4056 Add toggle for Zombified Piglin death always counting as a player kill when angry (Zombified Piglin XP farm nerf option) 9935466 Add config option for Cleric Villagers to farm Nether Wart 47a1707 fix typos 6e42ce8 Updated Upstream (Paper) 740b7d2 [ci-skip] Update readme with downloads API info AirplaneLite Changes: 5526dde Add download link to readme
264 lines
15 KiB
Diff
264 lines
15 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 3bbf1bab565d14176bc9facdbadf0ce6a868eeed..14f01dcd8890f6bd0ddda7da8bdebb8f5d546089 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
|
|
@@ -585,7 +585,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()); // Tuinity - we have our own bstats page // Purpur
|
|
+ Metrics metrics = new Metrics("Yatopia", serverUUID, logFailedRequests, Bukkit.getLogger()); // Tuinity - we have our own bstats page // Purpur // Yatopia
|
|
|
|
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
|
|
String minecraftVersion = Bukkit.getVersion();
|
|
@@ -595,7 +595,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")); // Tuinity - we have our own bstats page // Purpur
|
|
+ metrics.addCustomChart(new Metrics.SimplePie("yatopia_version", () -> (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown")); // Tuinity - we have our own bstats page // 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 74ed02fa9296583977bb721014b10ff8b708b43c..a13c7b2b5bc79ecaea404779149ed02c4600a61b 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
|
@@ -18,6 +18,7 @@ public final class PaperConsole extends SimpleTerminalConsole {
|
|
protected LineReader buildReader(LineReaderBuilder builder) {
|
|
return super.buildReader(builder
|
|
.appName("Paper")
|
|
+ .appName("Yatopia") // Yatopia
|
|
.variable(LineReader.HISTORY_FILE, java.nio.file.Paths.get(".console_history"))
|
|
.completer(new ConsoleCommandCompleter(this.server))
|
|
);
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index 3c4c2cb46151c2d97a534fcd77ddc0b5fab7066c..58cc0832ab17947fdf3089fae98f8e4f173763e7 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -1521,7 +1521,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
}
|
|
|
|
public String getServerModName() {
|
|
- return "Tuinity"; // Tuinity //Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
|
+ return "Yatopia"; // Yatopia // Tuinity //Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
|
}
|
|
|
|
public CrashReport b(CrashReport crashreport) {
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index 2f72612371dbdf57f1cffec98b063fb54ef09c33..181606d22adda556f3267ee7e7c69723c36ba909 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 = "Tuinity"; // Paper // Tuinity
|
|
+ private final String serverName = "Yatopia"; // Paper // Tuinity // 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 dbc934b374ff1b9eb4b66d2365e89c39c951763b..3c603e2358de71f534e88551b72f202d190f58fe 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
@@ -275,7 +275,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://yatopia.net/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 0f7f1503d07bdff7ce7644dfe21e444adb52c7db..2ff9bae66826ccef8929fc643275bffd7e883b58 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
|
@@ -353,7 +353,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
|
|
|
@Override
|
|
public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
|
|
- return new com.destroystokyo.paper.PaperVersionFetcher();
|
|
+ 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 001b1e5197eaa51bfff9031aa6c69876c9a47960..bd5d7508b1c44fba776c5d7fa4454ff5c95c8709 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/com.tuinity/tuinity-api/pom.properties"); // Tuinity
|
|
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.yatopiamc/yatopia-api/pom.properties"); // 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 4d310908489953d6d061b2358f614142edacb62e..121e7cd534558dcc249fb9a3bffbd22fb436fba5 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
|
|
@@ -158,14 +158,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.server.World.lastPhysicsProblem != null )
|
|
{
|
|
@@ -188,12 +188,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 );
|
|
@@ -209,7 +209,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/org/yatopiamc/yatopia/server/YatopiaVersionFetcher.java b/src/main/java/org/yatopiamc/yatopia/server/YatopiaVersionFetcher.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..e6564bae963cda66ee4152648836f172f7e4ea91
|
|
--- /dev/null
|
|
+++ b/src/main/java/org/yatopiamc/yatopia/server/YatopiaVersionFetcher.java
|
|
@@ -0,0 +1,96 @@
|
|
+package org.yatopiamc.yatopia.server;
|
|
+
|
|
+import com.destroystokyo.paper.VersionHistoryManager;
|
|
+import com.google.common.base.Charsets;
|
|
+import com.google.gson.Gson;
|
|
+import com.google.gson.JsonObject;
|
|
+import com.google.gson.JsonSyntaxException;
|
|
+import java.io.BufferedReader;
|
|
+import java.io.IOException;
|
|
+import java.io.InputStreamReader;
|
|
+import java.net.HttpURLConnection;
|
|
+import java.net.URL;
|
|
+import javax.annotation.Nonnull;
|
|
+
|
|
+import com.destroystokyo.paper.util.VersionFetcher;
|
|
+import javax.annotation.Nullable;
|
|
+
|
|
+public class YatopiaVersionFetcher implements VersionFetcher {
|
|
+
|
|
+ private static final String GITHUB_BRANCH_NAME = "ver/1.16.4";
|
|
+
|
|
+ @Override
|
|
+ public long getCacheTime() {
|
|
+ return 3600000;
|
|
+ }
|
|
+
|
|
+ @Nonnull
|
|
+ @Override
|
|
+ public String getVersionMessage(@Nonnull String serverVersion) {
|
|
+ String[] parts = serverVersion.substring("git-Yatopia-".length()).split("[-\\s]");
|
|
+ String updateMessage = getUpdateStatusMessage("YatopiaMC/Yatopia", GITHUB_BRANCH_NAME, parts[0]);
|
|
+ String history = getHistory();
|
|
+ return history != null ? history + "\n" + updateMessage : updateMessage;
|
|
+ }
|
|
+
|
|
+ private String getUpdateStatusMessage(String repo, String branch, String versionInfo) {
|
|
+ versionInfo = versionInfo.replace("\"", "");
|
|
+ int distance = fetchDistanceFromGitHub(repo, branch, versionInfo);
|
|
+
|
|
+ switch (distance) {
|
|
+ case -1:
|
|
+ return "Error obtaining version information";
|
|
+ case 0:
|
|
+ return "You are running the latest version";
|
|
+ case -2:
|
|
+ return "\u00AF\\_(\u30C4)_/\u00AF";
|
|
+ default:
|
|
+ return "You are " + distance + " version(s) behind";
|
|
+ }
|
|
+ }
|
|
+
|
|
+ // 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();
|
|
+ connection.connect();
|
|
+ if (connection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) return -2; // Unknown commit
|
|
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), Charsets.UTF_8))) {
|
|
+ JsonObject obj = new Gson().fromJson(reader, JsonObject.class);
|
|
+ String status = obj.get("status").getAsString();
|
|
+ switch (status) {
|
|
+ case "identical":
|
|
+ return 0;
|
|
+ case "behind":
|
|
+ return obj.get("behind_by").getAsInt();
|
|
+ default:
|
|
+ return -1;
|
|
+ }
|
|
+ } catch (JsonSyntaxException | NumberFormatException e) {
|
|
+ e.printStackTrace();
|
|
+ return -1;
|
|
+ }
|
|
+ } catch (IOException e) {
|
|
+ e.printStackTrace();
|
|
+ return -1;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ // from PaperVersionFetcher
|
|
+ @Nullable
|
|
+ private String getHistory() {
|
|
+ final VersionHistoryManager.VersionData data = VersionHistoryManager.INSTANCE.getVersionData();
|
|
+ if (data == null) {
|
|
+ return null;
|
|
+ }
|
|
+
|
|
+ final String oldVersion = data.getOldVersion();
|
|
+ if (oldVersion == null) {
|
|
+ return null;
|
|
+ }
|
|
+
|
|
+ return "Previous version: " + oldVersion;
|
|
+ }
|
|
+
|
|
+}
|
|
\ No newline at end of file
|