mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@7b3b593 [ci skip] Update checkout action in workflow (#8510) PaperMC/Paper@36869cc Fix new block data in EntityChangeBlockEvent for silverfish when mobGriefing isn't enabled (#8099) PaperMC/Paper@2432233 Add allow server listing & text filtering client options (#7595) PaperMC/Paper@954e6f0 Fix a bunch more forceDrops for dropping items (#8095) PaperMC/Paper@32d95e9 Track projectile source for fireworks from dispensers (#8044) PaperMC/Paper@0249750 Fix EntityArgument suggestion permissions to align with EntitySelector#checkPermissions (#8511) PaperMC/Paper@8acb05d Make CommandSyntaxException implement ComponentMessageThrowable (#8513) PaperMC/Paper@c264018 [ci skip] Undo modification to removed patches in latest commit (#8512) PaperMC/Paper@304ab35 [ci skip] Remove old todo file PaperMC/Paper@8a4b752 Fix wrong descriptor in ASMEventExecutorGenerator (#8506) PaperMC/Paper@b743144 Fix MC-147659 (#8423) PaperMC/Paper@aaf5e39 Deprecate unused VehicleEntityCollisionEvent methods (#8498)
51 lines
2.6 KiB
Diff
51 lines
2.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Ben Kerllenevich <ben@omega24.dev>
|
|
Date: Sat, 25 Jun 2022 19:40:36 -0400
|
|
Subject: [PATCH] Spark Profiler
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index fd58d9e6a19fb04e1a93cd0aa0fa12a405abaee1..39126cfe915c5e5777813b14ceab6427205b2a76 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -420,7 +420,38 @@ public final class CraftServer implements Server {
|
|
if (!pluginFolder.exists()) {
|
|
pluginFolder.mkdirs();
|
|
}
|
|
- Plugin[] plugins = this.pluginManager.loadPlugins(pluginFolder, this.extraPluginJars());
|
|
+ // Purpur start
|
|
+ List<File> extraJars = this.extraPluginJars();
|
|
+ if (!Boolean.getBoolean("Purpur.IReallyDontWantSpark")) {
|
|
+ try {
|
|
+ File file = new File("cache", "spark.jar");
|
|
+ file.getParentFile().mkdirs();
|
|
+
|
|
+ boolean shouldDownload = true;
|
|
+ if (file.exists()) {
|
|
+ String fileSha1 = String.format("%040x", new java.math.BigInteger(1, java.security.MessageDigest.getInstance("SHA-1").digest(java.nio.file.Files.readAllBytes(file.toPath()))));
|
|
+ String sparkSha1;
|
|
+ try (java.io.BufferedReader reader = new java.io.BufferedReader(new InputStreamReader(new java.net.URL("https://sparkapi.lucko.me/download/bukkit/sha1").openStream()))) {
|
|
+ sparkSha1 = reader.lines().collect(Collectors.joining(""));
|
|
+ }
|
|
+
|
|
+ if (fileSha1.equals(sparkSha1)) {
|
|
+ shouldDownload = false;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ if (shouldDownload) {
|
|
+ java.nio.file.Files.copy(new java.net.URL("https://sparkapi.lucko.me/download/bukkit").openStream(), file.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING);
|
|
+ }
|
|
+
|
|
+ extraJars.add(file);
|
|
+ } catch (Exception e) {
|
|
+ getLogger().severe("Purpur: Failed to download and install spark plugin");
|
|
+ e.printStackTrace();
|
|
+ }
|
|
+ }
|
|
+ Plugin[] plugins = this.pluginManager.loadPlugins(pluginFolder, extraJars);
|
|
+ // Purpur end
|
|
// Paper end
|
|
for (Plugin plugin : plugins) {
|
|
try {
|