Yatopia/patches/server/0002-Brandings.patch
Simon Gardling 99a93cf526
upstream (#421)
* Updated Upstream and Sidestream(s) (Paper/Tuinity/Purpur/Airplane/Empirecraft/Origami)

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:
d23f8b62e fix? #5222
0f2575de2 fix? #5222
7c3499702 fix? #5218
c8eec830b fix #5217
a235c77ce Adventure 4.5.0
511cd52f0 fix #5214
33d4f608b fix stupid legacy chat garbage
a1eebfea9 fix #5212 and #5213
466820160 Upstream Update (#5211)
2a0ee4b65 Add support for hex color codes in console
4e958e229 We're going on an Adventure! (#4842)
1a9735611 Stop loop when flags set to false (#5101)
a5928db4a [Auto] Updated Upstream (CraftBukkit)
5fd19303f Call PreCreatureSpawnEvent for more spawn reasons (#5201)

Tuinity Changes:
2f298d3 Fix getEntities for ender dragon parts

Purpur Changes:
55af107 Updated Upstream (Paper)
8369588 Updated Upstream (Paper & Tuinity)
14906a1 Allow for removing italics from items renamed in the anvil by starting the text with '&r'
f599c59 Update silk touch spawners patch to use adventure
e17ee14 Update anvil colors patch to use adventure
b538cd9 Updated Upstream (Paper)
c08f028 Updated Upstream (Tuinity)
90f67f8 Updated Upstream (Paper)
c98cc6b Configs for if Wither/Ender Dragon can ride vehicles
2d2e1d4 Fix Wither and Ender Dragon being able to ride boats when they cannot in Paper/Vanilla

Airplane Changes:
3fc432c [skip ci] Add Patrons section
4b9dd63 Skip POI finding if stuck in vehicle
1ba97ae Updated Upstream (Tuinity)

Empirecraft Changes:
58dee2db Updated Paper
48c1161a Updated Paper

Origami Changes:
654b344 Only try to update below hopper if non-ticking is enabled

* Updated Upstream and Sidestream(s) (Paper)

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:
d5cb9308f fix #5224

* it works, finally

* I think everything is fixed now....

* Updated Upstream and Sidestream(s) (Paper/Tuinity/Purpur/Airplane/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:
2dd5dccf0 Add config option for displayname in quit message (#5260)
63fe5e4b7 Fix further issues with rgb text pattern matching
89be8185d Don't grab the threads stacktrace when dumping same thread
ca4c781d8 [Auto] Updated Upstream (Bukkit/CraftBukkit)
6ae212125 Display name should never be null
bf2f8aeaf Add @NotNull to Key in org.bukkit.sound (#5241)
01f9b65f9 Sound can implement Adventure's Sound.Type
aa282a1a0 Don't try to deserialize a null string in legacy method
9bcd08cb3 [CI-SKIP] [Auto] Rebuild Patches
ea6fd6076 [Auto] Updated Upstream (Bukkit)
d9b02e94d Misc thread dumps (#5200)
a0093e142 Adventure 4.5.1
afea0e8ab Add links to the Adventure javadocs
846783c8a Fix a couple of typos in the javadoc for Player (#5235)
a2574d8f5 Replace usages of LegacyComponentSerializer.legacySection() in Paper-Server with PaperAdventure.LEGACY_SECTION_UXRC (#5233)
cae142b85 Enable Hex colors on PaperAdventure.LEGACY_SECTION_UXRC, and use it for sending messages to console command sender (#5230)
c1635eabb PlayerDeathEvent#getDeathMessage should provide translation for legacy reasons #5227
3f74af202 Fix Log4J converter not parsing hex without named colors (#5228)

Tuinity Changes:
7734ef0 Detail player ticking in watchdog dumps

Purpur Changes:
529c260 [ci-skip] Update Gradle to 6.8.3
831b8d7 Updated Upstream (Paper)
d3c8fb2 Updated Upstream (Paper)
4602b9b Updated Upstream (Paper)
18f97a9 Make fox breeding cooldown work, add villager breeding cooldown config
868c9ca Updated Upstream (Paper)
274c7b2 Updated Upstream (Paper)

Airplane Changes:
9f3cad3 Updated Upstream (Tuinity)

Empirecraft Changes:
3e3e8e5e Updated Paper

* 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:
df4c68b66 fix #5279 - clickable links again
ff5ff3af4 Print command usage for /paper entity list at more places (#5282)
5d779a621 Implements PlayerHandshakeEvent#getOriginalSocketAddressHostname and deprecates PlayerHandshakeEvent(String, boolean) in favour of PlayerHandshakeEvent(String, String, boolean)
6fab1ee3a Expose Tracked Players
b53a650a5 Clear SyncLoadInfo
c02c22fde fix: legacy component serialisation was wiped out

Purpur Changes:
a5fa038 Updated Upstream (Paper)

Empirecraft Changes:
95ac7f87 Updated Paper

* Updated Upstream and Sidestream(s) (Paper)

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:
06900aef5 Fix username connecting with no texture being overwritten by usercache (#4970)

* Updated Upstream and Sidestream(s) (Paper/Purpur)

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:
9907cedec New chat events for better Adventure support (#5289)

Purpur Changes:
34f0e57 Updated Upstream (Paper)

* Updated Upstream and Sidestream(s) (Paper/Purpur/Paper)

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:
9907cedec New chat events for better Adventure support (#5289)

Purpur Changes:
34f0e57 Updated Upstream (Paper)

Paper Changes:
60e92c061 fix #5292 with help from @JRoy

* that doesn't need to be there

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

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:
7d56f38ed Do not use the bukkit singleton for the GUI (Fixes #5301)
4c9bdf53a Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5299)
8647bd130 Improve ServerGUI
fcc6d3359 Throw proper exception on empty JsonList file
17d2e1291 Fix interact event in adventure mode
964e0bf42 MC-29274: Fix Wither hostility towards players
9e24a5213 Fixed furnace cook-speed multiplier losing precision when calculating cook time
c7e42faa3 Do not create unnecessary copies of the passenger list
40881ad67 added tnt minecarts to the tnt height nerf
26be708f4 Remove streams from SensorNearest
5b5989b21 fix nullability of playerlist header/footer, closes #5290
45bc531dd Fix Material#getTranslationKey for Block Materials (#5294)

Purpur Changes:
68ff99e Updated Upstream (Paper)

Airplane Changes:
80d65be Add more licenses
4d27e5b Use our own bstats, move mcdev fixes

* whoops

* Updated Upstream and Sidestream(s) (Airplane)

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.

Airplane Changes:
d50d4e1 Rewrite disabling of POI searching when stuck

* Updated Upstream and Sidestream(s) (Paper)

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:
be1687914 stop firing pressure plate EntityInteractEvent for ignored entities (fixes #4962)

* Updated Upstream and Sidestream(s) (Paper/Paper)

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:
be1687914 stop firing pressure plate EntityInteractEvent for ignored entities (fixes #4962)

Paper Changes:
aaef1d5cc fix file conversion
674d8f7f7 Make discovered maps config work in treasure maps from loot tables too

* Updated Upstream and Sidestream(s) (Paper)

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:
616b1f3cd consider enchants for destroy speed

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

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:
5b20df6bf added PlayerNameEntityEvent
ff9c82444 Add worldborder events

Purpur Changes:
d93887a Updated Upstream (Paper)

Airplane Changes:
02743da Complete /airplane command
a2be422 Add /airplane command
3b90baf [SKIP-CI] Use patreon for sponsor button

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

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:
be7cde2c7 [CI-SKIP] Always check PATH for JDK (#5315)

Tuinity Changes:
09e1a10 Fix NPE in light exception handler
0ae7c2c Dump even more info for ticking entities
2e4a930 Store changed positions inside field on light engine

Purpur Changes:
c54e65f Add config for snow on blue ice
2fdd7d4 One Punch Man! (#185)
c2bd3de Dont run with scissors (#184)

* Updated Upstream and Sidestream(s) (Paper)

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:
54ec85949 Prevent grindstones from overstacking items
d7795080c Fix NPE for AIR in meta operations in ItemStack
2e70796c7 [CI-SKIP] Improve documentation of PreCreatureSpawnEvent (#5244)
7bb92e750 [CI-SKIP] Add JavaDoc links to Tag class pointing to custom Paper tags (#5285)
28cd686bf fix per-world difficulty command (#5306)

* Updated Upstream and Sidestream(s) (Tuinity/Airplane/Akarin/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.

Tuinity Changes:
71b089f Do not run raytrace logic for AIR

Airplane Changes:
815b461 Flare

Akarin Changes:
62342de Update README.md
dfcbbf5 Update SUPPORT.md
4225fcf Updated Tuinity's Paper
3950fd5 Updated build badge
f2d367c Merge branch 'ver/1.15.2' into ver/1.16.4

Empirecraft Changes:
3718e178 Updated Paper

* whoops

* 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:
f87cb79 Make entity tracker use highest range of passengers

* Updated Upstream and Sidestream(s) (Airplane)

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.

Airplane Changes:
dd6a75c Updated Upstream (Tuinity)
48ff3e0 Some tweaks to increase Flare's compatibility

* Updated Upstream and Sidestream(s) (Airplane/Airplane)

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.

Airplane Changes:
dd6a75c Updated Upstream (Tuinity)
48ff3e0 Some tweaks to increase Flare's compatibility

Airplane Changes:
e7fc41a Update to latest version of Flare

* Updated Upstream and Sidestream(s) (Airplane)

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.

Airplane Changes:
86781ec Multithreaded Tracker!

* Updated Upstream and Sidestream(s) (Paper)

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:
7f72c4675 Use implementation-provided legacy serializer for events
27a8d99ec Adventure 4.7.0
e65bd35a1 Respect teams in legacy chat name if configured (#5321)
b31089a92 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5325)
a52b30814 Fix title swapping fadeIn and stay

* Updated Upstream and Sidestream(s) (Paper)

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:
e4d8a6279 Implement Keyed on World
bcb63dab7 [CI-SKIP] [Auto] Rebuild Patches
48342b06c Allow signs that are inside of the spawn protection to be right clicked to use their run_command tag
c229f90c1 Add Block#isValidTool
20e709c1d Add recipe to cook events
2dcf8bff4 legacy formatting will be the death of me
f597fea0d legacy formatting is worse than walking around in wet socks

* Updated Upstream and Sidestream(s) (Paper/Purpur)

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:
e4d8a6279 Implement Keyed on World
bcb63dab7 [CI-SKIP] [Auto] Rebuild Patches
48342b06c Allow signs that are inside of the spawn protection to be right clicked to use their run_command tag
c229f90c1 Add Block#isValidTool
20e709c1d Add recipe to cook events
2dcf8bff4 legacy formatting will be the death of me
f597fea0d legacy formatting is worse than walking around in wet socks

Purpur Changes:
63c370c One Punch Man 2: Electric Boogaloo (#187)
2021-03-09 15:11:49 -06:00

292 lines
16 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 c1280478ee4565003883df9607d4a8a0e8fe4faa..c6cfdea783eaa40d4eb581a9208d6cdb72dace5b 100644
--- 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
protected LineReader buildReader(LineReaderBuilder builder) {
return super.buildReader(builder
- .appName("Purpur") // Purpur
+ .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/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index 03d5a9f923597c07d050465e261efe9a8bc935a6..439842cb08e600e007a4b447daac182e59d1a1b2 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);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 12b92ee0491c82a72d1646d14116e187dd965fe6..d5c2fa2363ec898e6fdf16699c3e3e3fef98410c 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 // Purpur
+ private final String serverName = "Yatopia"; // Paper // Tuinity // 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 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
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index b14e9a2cd6e849fe91a2512f379036a284323420..54aebe9da1f31b3250b349a91e78eadb7a031096 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -377,7 +377,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 13b98439320ac1401a920c01d7cf5a4b3a23deff..d2f272fd733f7eee9a89029baecccfac7e45baf4 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 // Purpur
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.yatopiamc/yatopia-api/pom.properties"); // Tuinity // 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 089ddda8892c3660c5dcb62d0fd56544857a2eba..8ee165d1c752e53601254f734507370b91ad7b73 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.server.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/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