mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-29 06:05:14 +01:00
ac524e348f
* 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:
0641de2d4 [CI-SKIP] Change some fields to textara (#5405)
98a34ea47 [CI-SKIP] 🚀 Upgrade to new form-based templates (#5278)
bca97a8f7 replace spaces in world key (touches #5397)
de94f6485 Refactor chat message composition (#5396)
e27f334bb [CI-SKIP] Fix makemcdevsrc.sh for nms relocations (#5389)
ae15e85da Updated Upstream (CraftBukkit)
26fe0ac5a Only set despawnTimer for Wandering Traders spawned by MobSpawnerTrader (#5391)
b748eb7b8 Fix VanillaMobGoalTest#testBukkitMap (#5390)
18dbbb578 [Auto] Updated Upstream (CraftBukkit)
fac9cc5d5 [CI-SKIP] Ignore .gitignore
087aa70e7 Deprecate ItemStack#setLore(List<String>) and ItemStack#getLore, add Component based alternatives
9889c651c apply fixup
c310f0a61 Updated Upstream (Bukkit/CraftBukkit)
f17560ab0 wtf is this t file -jmp
347f3a9b8 fix compile
700e9e6a5 rebase
cf4dc464a Revert de5f4e469...c270abe96
6870db613 script & POM fix
743c6533c Replace ** with * (BSD/macOS)
376d7b097 Don't remove the .java
fcb3fd42a Fix macOS/BSD support
8cfc05249 Link correctly
ba1031ca7 Rename work dir
c8d844ab7 Actually fix preloading this time
e62aa5e3e Fix class preloading
1c03cf898 It's mojang math, not minecraft math
1034873df Apply fixups
39b125771 Use revision file
956150da7 Welcome to 1.16.5-R0.2
ccb217c01 Change cache keys
0d217001c more work
f6d820f07 It compiles
0f78e9525 More work
1718f61bf Updated Upstream (CraftBukkit/Spigot)
b28d46114 Update scripts for NMS repackaging
d4532f7e7 bug #5373 - fix AsyncChatEvent not being posted when processing a legacy APCE continuation
522ae1c51 Replace all block states of a specified block (#5055)
1cda67118 [Auto] Updated Upstream (CraftBukkit)
8c74d3126 Updated Upstream (Bukkit) (#5359)
fd3c66a91 bug #5362 - correctly pass "render type" when registering a new scoreboard objective
Tuinity Changes:
9bdcb9b Delete work dir when running jar
6351d7c Updated Upstream (Paper)
932c199 Generate mc-dev correctly
bf3e737 Make packet limiter work from IDE
1686f38 Fix packet limiter config
f40f7b4 Update README.md styling (#264)
da1c3ac GH Actions Changes (#213)
5f325ec Updated Upstream (Paper)
0f83fe4 Updated Upstream (Paper)
44e8e5d Do not load extra radius of chunks when loading a single chunk
31f9cae Revert custom table implementation for blockstate states
9ac33d1 Be aware of entity teleports when chunk checking entities
18c7f3f Always set impulse for projectiles to true, even if hit event failed
Airplane Changes:
f94d399 Merge pull request #18 from notOM3GA/upstream/nms-repackage
0fc6226 Force build for Flare update
08439d6 Updated Upstream (Tuinity)
0f80443 Updated Upstream (Tuinity)
2f6cbdc More debug for plugins not shutting down tasks
12e1b61 Updated Upstream (Tuinity)
fc778d3 Update README.md
db6b0eb Merge pull request #16 from DeadSteve51/patch-2
b23bee3 Remove debug
8157e98 Config style, flare style, disable tracker by def
98d0b58 Updates to README
Purpur Changes:
75b07a0 Fix stack overflow on armorstand movement
f754a7b Sneak to bulk process composter
1362f49 Updated Upstream (Paper, Tuinity, & Airplane)
5bf8615 [ci-skip] Conflict on change for adventure deprecations
114b37b Add purpur.yml to Flare (#204)
c6dce38 forgot the crops
c004236 Configurable ravager griefable blocks list
766246a [ci-skip] remove duplicate patch
ac93477 Config to make Creepers explode on death (#201)
297181e Updated Upstream (Paper, Tuinity, & Airplane)
45b9a18 Config to disable Llama caravans (#203)
a99a83b Allow fully disabling farmland trampling
3aa4f68 Tick fluids config
0e34d59 Add missing imports :/
3dd9f46 Updated Upstream (Paper, Tuinity, & Airplane)
Empirecraft Changes:
1b579407 Improve importmcdev script and fix first server patch
f597a82e Update generatesources script
218f5298 Fix patches - imported files
847cf558 Updated Paper
d51410c3 Updated Paper
fb3301fd Fix bow entity ai speed/distance
dbde1dc4 Add isJoined boolean to fake players
a23317f7 Update Fake Player API - misc changes
a970b77f Updated Paper
* Updated Upstream and Sidestream(s) (Paper/Airplane/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:
7259c32ba [CI-SKIP] [Auto] Rebuild Patches
0e06e912e Fix annotations so Inventory#getContents returns non-null array with nullable type (#5350)
b90b4f8ad Properly apply Sign#isEditable to TEs when calling BlockState#update
Airplane Changes:
87d4a17 Track queue debug command
Purpur Changes:
d44f93e Fix tpsbar with naughty plugins
* Updated Upstream and Sidestream(s) (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.
Purpur Changes:
99f1ce6 Add enchantment target for bows and crossbows
af9181e Add configurable drowning settings (closes #221) (#222)
f72437b Remove mcdevimports.* (#228)
08de42d Add config for infinity on crossbows (#215)
5f76cb3 Add a config for villager trading (#210)
67ffa05 Add config for disabling skipping the night (#209)
* revert paper commit that made the build fail (CI still doesn't work)
* Update build.yml
* test2
* Update build.yml
* take7
* how often does md_5 change mappings?
this will come back to bite me in exactly 17 days
* Revert "how often does md_5 change mappings?"
This reverts commit 8b05c16d6c
.
* 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:
6caa330c6 Add checkerframework nullness annotations to accepted list for AnnotationTest (#5409)
Purpur Changes:
96f5360 Config to allow for unsafe enchants (#235)
b6235af Rebase on latest Purpur (#230)
754948e Updated Upstream (Paper)
f55c0e9 Option to make doors require redstone (closes #171)
34d5818 Fix paper using wrong annotations
f31bcc6 Updated Upstream (Paper & Airplane)
55244dd Config to show Armor Stand arms on spawn (#231)
c726479 Config to disable hostile mob spawn on ice `:)` (closes #214) (#229)
26a0094 Break individual slabs when sneaking (closes #218)
c3de3ac Fix wart farmers plating vegetables on soul sand
* Updated Upstream and Sidestream(s) (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.
Tuinity Changes:
1b0d783 Updated Upstream (Paper)
2c16629 Fix NPE in NetworkManager#execute
Purpur Changes:
0d25d39 Add cache for slime max health (resolves #234)
39dd78a Fix #240 - Separate slab breaking triggers every single time
1ecb9ef Projectile offsets config (#237)
33ee1e7 Configurable sponge absorption (closes #232) (#236)
a0355eb Add Note Block to disabled block updates (#241)
* 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:
8b47131da Optimize short circuit evaluation of sign check (#5348)
1a2fd12a5 Drop carried item when player has disconnected (#5036) (#5166)
68af93524 Use PaperAdventure.PLAIN instead of PlainComponentSerializer.plain() for AdventureComponent#getString (#5414)
* Updated Upstream and Sidestream(s) (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.
Tuinity Changes:
94f025a Updated Upstream (Paper)
ab00f31 Do not load chunks around fake players
a9599d8 Fix incorrect parsing of positive target-send-rate
2a6cd81 Make sure to remove correct TE during TE tick
Purpur Changes:
9dfc780 Config for powered rail activation distance (#248)
Co-authored-by: duplexsystem <duplexsys@protonmail.com>
273 lines
17 KiB
Diff
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 4d9e685c691a37078ff7452e50ab8c13999dbe10..0751ce5b578eff8b1dad44e976b656b6cfa7daf3 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 6355f246809982f6da34671be22066a83cfba42c..9a9e2692cc058ed3bcafd0cee37c4c9012e4a983 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
@@ -183,7 +183,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 298b0dfc67906a96d61b4d40919d3363cede0401..7771fa5c98809b6c3aeff78ab9d0b8ec2178accc 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 655d45b9c664baee77f356d315baacd40209280f..9d22236808d89183fd1a0a85465533a0b2de4358 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
@@ -277,7 +277,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 609eda567751b2f1cf74e9f090ca5cb0c1d771cc..ced87bb10dcc0bd1fdfd99d6f05de079e6ec6eee 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 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();
|