Yatopia/patches/server/0002-Brandings.patch

292 lines
16 KiB
Diff
Raw Normal View History

2020-07-17 18:05:50 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: YatopiaMC <yatopiamc@gmail.com>
2020-02-26 18:37:58 +01:00
Date: Wed, 26 Feb 2020 18:37:34 +0100
Subject: [PATCH] Brandings
2020-09-13 20:50:36 +02:00
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
Updated Upstream and Sidestream(s) (Tuinity/EMC/Origami/Purpur/AirplaneLite) 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: 3e77330 Updated Upstream (Paper) EMC Changes: e45a78e4 Update the API as well - setTargetRange to Double where null is default FOLLOW_RANGE 9fc6891d Default target range to the follow range a1e2e2a3 Fix an issue with players in vehicles in vehicles desyncing b6e2f202 Add a Dead vehicle reason to VehicleExitEvent 72b0da43 Use the correct entity local variable ad32d0d6 Fix bug with entity passengers not executing entity tasks 194aaafb Updated Paper cb3a7bb7 Always convert Lore/Name of an item to ensure consistency 6c63538d Revert "Updated Paper" 8837d5a9 Limit fortress spawns to the nether 005cdda9 Updated Paper 1476d693 Fix Lore comparisons to use legacy format 588f30f9 Quick fix the rcon log issue for now 475e626a Fix World Meta loading 3ad5f8a7 Remove RCON Thread Logs 7f3c4a25 Fix dismounting from vehicle when teleporting cross dimension 595bd307 Prevent NPE for PathfinderGoalMeleeAttack 0a64d9e9 Fix EntityDismountEvent reason c25ef322 Updated Paper Origami Changes: 36c0e05 Fix wrong circular dependency error if plugin depends on own provides 655fa5f Add option to disable legacy plugin support Purpur Changes: 79d304f Updated Upstream (Paper) bef678f [ci-skip] Simpler method of merging metadata files 3b18ff8 Updated Upstream (Paper) 25c7772 Apply the AppendingTransformer for `META-INF/services/java.sql.Driver` faf0db9 Bump config version to 10 3d1926e More base attribute stuff 43d6dab Updated Upstream (Paper) 2fd92fe [ci-skip] Setup repo for api publishing 26b0736 Updated Upstream (Paper) e704540 [ci-skip] Fix the remaining javadoc warnings a541703 [ci-skip] Fix import mc-dev task 64f5f9d Fix dependency relocations d7f1884 [ci-skip] Skip compiling tests as well as running them when using the `-Pfast` flag 3e08321 [ci-skip] Fix javadoc warnings (missing @param and @return) 1bfe697 [ci-skip] Remove paper's unsafe util 63b647c [ci-skip] Make it easier to fork Purpur using our scripts c453170 Fix relocations 7e331c2 Fix #118 Phantom fire time not working 844337c Fix lag from villager lobotomize check 2ec0dba Updated Upstream (Paper) 69c6484 Build using Toothpick scripts (#122) AirplaneLite Changes: ff087b7 Changes from Purpur 7263c2f Fix maven subproject URL 819c731 Switch to Purpur's Toothpick
2020-12-22 15:01:31 +01:00
index 4d8740678049aa749b42618470e9cc838555528d..159f72efe20f8fee940bd00ae7af00f026f51b1a 100644
2020-09-13 20:50:36 +02:00
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
Updated Upstream and Sidestream(s) (Tuinity/EMC/Origami/Purpur/AirplaneLite) 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: 3e77330 Updated Upstream (Paper) EMC Changes: e45a78e4 Update the API as well - setTargetRange to Double where null is default FOLLOW_RANGE 9fc6891d Default target range to the follow range a1e2e2a3 Fix an issue with players in vehicles in vehicles desyncing b6e2f202 Add a Dead vehicle reason to VehicleExitEvent 72b0da43 Use the correct entity local variable ad32d0d6 Fix bug with entity passengers not executing entity tasks 194aaafb Updated Paper cb3a7bb7 Always convert Lore/Name of an item to ensure consistency 6c63538d Revert "Updated Paper" 8837d5a9 Limit fortress spawns to the nether 005cdda9 Updated Paper 1476d693 Fix Lore comparisons to use legacy format 588f30f9 Quick fix the rcon log issue for now 475e626a Fix World Meta loading 3ad5f8a7 Remove RCON Thread Logs 7f3c4a25 Fix dismounting from vehicle when teleporting cross dimension 595bd307 Prevent NPE for PathfinderGoalMeleeAttack 0a64d9e9 Fix EntityDismountEvent reason c25ef322 Updated Paper Origami Changes: 36c0e05 Fix wrong circular dependency error if plugin depends on own provides 655fa5f Add option to disable legacy plugin support Purpur Changes: 79d304f Updated Upstream (Paper) bef678f [ci-skip] Simpler method of merging metadata files 3b18ff8 Updated Upstream (Paper) 25c7772 Apply the AppendingTransformer for `META-INF/services/java.sql.Driver` faf0db9 Bump config version to 10 3d1926e More base attribute stuff 43d6dab Updated Upstream (Paper) 2fd92fe [ci-skip] Setup repo for api publishing 26b0736 Updated Upstream (Paper) e704540 [ci-skip] Fix the remaining javadoc warnings a541703 [ci-skip] Fix import mc-dev task 64f5f9d Fix dependency relocations d7f1884 [ci-skip] Skip compiling tests as well as running them when using the `-Pfast` flag 3e08321 [ci-skip] Fix javadoc warnings (missing @param and @return) 1bfe697 [ci-skip] Remove paper's unsafe util 63b647c [ci-skip] Make it easier to fork Purpur using our scripts c453170 Fix relocations 7e331c2 Fix #118 Phantom fire time not working 844337c Fix lag from villager lobotomize check 2ec0dba Updated Upstream (Paper) 69c6484 Build using Toothpick scripts (#122) AirplaneLite Changes: ff087b7 Changes from Purpur 7263c2f Fix maven subproject URL 819c731 Switch to Purpur's Toothpick
2020-12-22 15:01:31 +01:00
@@ -593,7 +593,7 @@ public class Metrics {
2020-09-13 20:50:36 +02:00
boolean logFailedRequests = config.getBoolean("logFailedRequests", false);
// Only start Metrics, if it's enabled in the config
if (config.getBoolean("enabled", true)) {
Updated Upstream and Sidestream(s) (Tuinity/EMC/Purpur/AirplaneLite) 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: de6c239 Merge branch 'master' of https://github.com/Spottedleaf/Tuinity into ver/1.16.4 cc34294 Copy passenger list in enderTeleportTo 8c5d945 Improve abnormal server shutdown process 0ae7e67 Do not load chunks during a crash report 0fbcf78 Fix small issue with handling of step height in colliding 4722d59 Updated Upstream (Paper) EMC Changes: 1d0cc885 Updated Paper Purpur Changes: 3776636 Implement TPSBar 258ae07 Updated Upstream (Paper) c51e391 Add back --zero-commit ef0b93d Rebuild patches 0ae637c Option for chests to open even with a solid block on top ce4ab83 Phantom flames on swoop 5e2d697 Don't apply potion effects on load either bbe5a58 Don't apply potion effect to wolves during worldgen 06c4f83 Get max health attribute even closer to vanilla 41f23a7 Updated Upstream (Tuinity) 787e35c Get max health equations for horse types closer to vanilla aed0867 Fix CraftSound backwards compatibility dfabf51 Start of the configurable base attributes a1fa221 Updated Upstream (Paper) 0174fcd Configurable default wolf collar color (#116) da48e0a [ci-skip] fix comment in last patch 65fde28 Add option for using milk to cure wolves 38efb4d Use a ThreadLocal SimpleDateFormat for CriterionProgress deserialization 4e6e1ff Revert "Fix concurrency issue with CriterionProgress deserialization" 55bde37 Fix concurrency issue with CriterionProgress deserialization b4be9ab Small fixes to rabid wolves patch 5943978 Updated Upstream (Paper) ac34692 Chance to spawn wolves as "rabid" (#114) 1b40f87 Updated Upstream (Paper) 69790ff Alphabetize in-game /plugins list AirplaneLite Changes: 76810f1 Updated Upstream (Tuinity)
2020-12-13 16:18:57 +01:00
- Metrics metrics = new Metrics("Purpur", serverUUID, logFailedRequests, Bukkit.getLogger()); // Purpur
+ Metrics metrics = new Metrics("Yatopia", serverUUID, logFailedRequests, Bukkit.getLogger()); // Purpur // Yatopia
2020-09-13 20:50:36 +02:00
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
String minecraftVersion = Bukkit.getVersion();
Updated Upstream and Sidestream(s) (Tuinity/EMC/Origami/Purpur/AirplaneLite) 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: 3e77330 Updated Upstream (Paper) EMC Changes: e45a78e4 Update the API as well - setTargetRange to Double where null is default FOLLOW_RANGE 9fc6891d Default target range to the follow range a1e2e2a3 Fix an issue with players in vehicles in vehicles desyncing b6e2f202 Add a Dead vehicle reason to VehicleExitEvent 72b0da43 Use the correct entity local variable ad32d0d6 Fix bug with entity passengers not executing entity tasks 194aaafb Updated Paper cb3a7bb7 Always convert Lore/Name of an item to ensure consistency 6c63538d Revert "Updated Paper" 8837d5a9 Limit fortress spawns to the nether 005cdda9 Updated Paper 1476d693 Fix Lore comparisons to use legacy format 588f30f9 Quick fix the rcon log issue for now 475e626a Fix World Meta loading 3ad5f8a7 Remove RCON Thread Logs 7f3c4a25 Fix dismounting from vehicle when teleporting cross dimension 595bd307 Prevent NPE for PathfinderGoalMeleeAttack 0a64d9e9 Fix EntityDismountEvent reason c25ef322 Updated Paper Origami Changes: 36c0e05 Fix wrong circular dependency error if plugin depends on own provides 655fa5f Add option to disable legacy plugin support Purpur Changes: 79d304f Updated Upstream (Paper) bef678f [ci-skip] Simpler method of merging metadata files 3b18ff8 Updated Upstream (Paper) 25c7772 Apply the AppendingTransformer for `META-INF/services/java.sql.Driver` faf0db9 Bump config version to 10 3d1926e More base attribute stuff 43d6dab Updated Upstream (Paper) 2fd92fe [ci-skip] Setup repo for api publishing 26b0736 Updated Upstream (Paper) e704540 [ci-skip] Fix the remaining javadoc warnings a541703 [ci-skip] Fix import mc-dev task 64f5f9d Fix dependency relocations d7f1884 [ci-skip] Skip compiling tests as well as running them when using the `-Pfast` flag 3e08321 [ci-skip] Fix javadoc warnings (missing @param and @return) 1bfe697 [ci-skip] Remove paper's unsafe util 63b647c [ci-skip] Make it easier to fork Purpur using our scripts c453170 Fix relocations 7e331c2 Fix #118 Phantom fire time not working 844337c Fix lag from villager lobotomize check 2ec0dba Updated Upstream (Paper) 69c6484 Build using Toothpick scripts (#122) AirplaneLite Changes: ff087b7 Changes from Purpur 7263c2f Fix maven subproject URL 819c731 Switch to Purpur's Toothpick
2020-12-22 15:01:31 +01:00
@@ -603,7 +603,7 @@ public class Metrics {
2020-09-13 20:50:36 +02:00
metrics.addCustomChart(new Metrics.SingleLineChart("players", () -> Bukkit.getOnlinePlayers().size()));
metrics.addCustomChart(new Metrics.SimplePie("online_mode", () -> Bukkit.getOnlineMode() ? "online" : (PaperConfig.isProxyOnlineMode() ? "bungee" : "offline"))); // Purpur
Updated Upstream and Sidestream(s) (Tuinity/EMC/Purpur/AirplaneLite) 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: de6c239 Merge branch 'master' of https://github.com/Spottedleaf/Tuinity into ver/1.16.4 cc34294 Copy passenger list in enderTeleportTo 8c5d945 Improve abnormal server shutdown process 0ae7e67 Do not load chunks during a crash report 0fbcf78 Fix small issue with handling of step height in colliding 4722d59 Updated Upstream (Paper) EMC Changes: 1d0cc885 Updated Paper Purpur Changes: 3776636 Implement TPSBar 258ae07 Updated Upstream (Paper) c51e391 Add back --zero-commit ef0b93d Rebuild patches 0ae637c Option for chests to open even with a solid block on top ce4ab83 Phantom flames on swoop 5e2d697 Don't apply potion effects on load either bbe5a58 Don't apply potion effect to wolves during worldgen 06c4f83 Get max health attribute even closer to vanilla 41f23a7 Updated Upstream (Tuinity) 787e35c Get max health equations for horse types closer to vanilla aed0867 Fix CraftSound backwards compatibility dfabf51 Start of the configurable base attributes a1fa221 Updated Upstream (Paper) 0174fcd Configurable default wolf collar color (#116) da48e0a [ci-skip] fix comment in last patch 65fde28 Add option for using milk to cure wolves 38efb4d Use a ThreadLocal SimpleDateFormat for CriterionProgress deserialization 4e6e1ff Revert "Fix concurrency issue with CriterionProgress deserialization" 55bde37 Fix concurrency issue with CriterionProgress deserialization b4be9ab Small fixes to rabid wolves patch 5943978 Updated Upstream (Paper) ac34692 Chance to spawn wolves as "rabid" (#114) 1b40f87 Updated Upstream (Paper) 69790ff Alphabetize in-game /plugins list AirplaneLite Changes: 76810f1 Updated Upstream (Tuinity)
2020-12-13 16:18:57 +01:00
- 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
2020-09-13 20:50:36 +02:00
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
Map<String, Map<String, Integer>> map = new HashMap<>();
2020-02-26 18:37:58 +01:00
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
index c1280478ee4565003883df9607d4a8a0e8fe4faa..c6cfdea783eaa40d4eb581a9208d6cdb72dace5b 100644
2020-02-26 18:37:58 +01:00
--- a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
@@ -17,7 +17,7 @@ public final class PaperConsole extends SimpleTerminalConsole {
@Override
2020-02-26 18:37:58 +01:00
protected LineReader buildReader(LineReaderBuilder builder) {
return super.buildReader(builder
- .appName("Purpur") // Purpur
2020-08-01 18:14:57 +02:00
+ .appName("Yatopia") // Yatopia
.variable(LineReader.HISTORY_FILE, java.nio.file.Paths.get(".console_history"))
2020-02-26 18:37:58 +01:00
.completer(new ConsoleCommandCompleter(this.server))
);
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index 83c1176888ead8fe045f1e1dfc78115ad2bf69f3..29ebf64a27ac34a2bfd11a904a5a30e01f766c43 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -182,7 +182,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);
}
2020-02-26 18:37:58 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 53deddce357170a712913d916ba1d58e663fc1a1..1286f0127300144abe4f78a3480acec42a5fc758 100644
2020-02-26 18:37:58 +01:00
--- 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
2020-02-26 18:37:58 +01:00
import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server {
- private final String serverName = "Purpur"; // Paper // Tuinity // Purpur
+ private final String serverName = "Yatopia"; // Paper // Tuinity // Purpur // Yatopia
2020-02-26 18:37:58 +01:00
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 448538cc8a3d16b028a0a6f0f05c9370a02f4259..e51dcb259d511c369806a83b96c2820f316e1401 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://yatopiamc.org/download ***"); // Paper // Tuinity // Yatopia
//System.err.println("*** Server will start in 20 seconds ***");
//Thread.sleep(TimeUnit.SECONDS.toMillis(20));
// Paper End
2020-02-26 18:37:58 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 37c561fb775cf7dd955b185b4ea94fecc574be63..9ef99b4a9e2a648a9245cfae70d12645a15fb12c 100644
2020-02-26 18:37:58 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -370,7 +370,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
2020-02-26 18:37:58 +01:00
@Override
public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
- return new net.pl3x.purpur.PurpurVersionFetcher();
+ return new org.yatopiamc.yatopia.server.YatopiaVersionFetcher(); // Yatopia
2020-02-26 18:37:58 +01:00
}
@Override
2020-03-08 15:59:59 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 13b98439320ac1401a920c01d7cf5a4b3a23deff..d2f272fd733f7eee9a89029baecccfac7e45baf4 100644
2020-03-08 15:59:59 +01:00
--- 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 // Purpur
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.yatopiamc/yatopia-api/pom.properties"); // Tuinity // Purpur // Yatopia
2020-03-08 15:59:59 +01:00
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 58d01c6f8abcd9e1792495abd08b186f9d03f834..476939bde38246eb0fd96e6a4ba8076c9d1b0ff4 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
@@ -162,14 +162,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 )
{
@@ -192,12 +192,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 );
@@ -213,7 +213,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..2898bfb109c63a93971bd38cc4778da1dc37c445
--- /dev/null
+++ b/src/main/java/org/yatopiamc/yatopia/server/YatopiaVersionFetcher.java
@@ -0,0 +1,123 @@
+package org.yatopiamc.yatopia.server;
+
+import com.destroystokyo.paper.VersionHistoryManager;
+import com.google.common.base.Charsets;
+import com.google.common.io.Resources;
+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.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;
+
+public class YatopiaVersionFetcher implements VersionFetcher {
+
+ @Override
+ public long getCacheTime() {
+ return 3600000;
+ }
+
+ @Nonnull
+ @Override
+ public String getVersionMessage(@Nonnull String serverVersion) {
+ if(serverVersion.equals("null")) return "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];
+ String updateMessage = getUpdateStatusMessage("YatopiaMC/Yatopia", branch, version);
+ String history = getHistory();
+ return history != null ? history + "\n" + updateMessage : updateMessage;
+ }
+
+ private String getUpdateStatusMessage(String repo, String branch, String versionInfo) {
+ int distance;
+ try {
+ int jenkinsBuild = Integer.parseInt(versionInfo);
+ distance = fetchDistanceFromJenkins(branch, jenkinsBuild);
+ } catch (NumberFormatException ignored) {
+ distance = fetchDistanceFromGitHub(repo, branch, versionInfo.replace("\"", ""));
+ }
+
+ 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";
+ }
+ }
+
+ // modified from PurpurVersionFetcher
+ private static int fetchDistanceFromJenkins(String branch, int jenkinsBuild) {
+ try {
+ 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();
+ return -2;
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ return -1;
+ }
+ }
+
+ // 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