(1.19) Make timings link clickable (#7897)

This commit is contained in:
Noah van der Aa 2022-06-08 22:27:24 +02:00 committed by GitHub
parent cbb47cacdb
commit 9107753202
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -163,10 +163,10 @@ index 0000000000000000000000000000000000000000..b47b7dce26805badd422c1867733ff4b
+} +}
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..4092a227a540a1c5cfb95efcc2a36e049b9a979c index 0000000000000000000000000000000000000000..46297ac0a19fd2398ab777a381eff4d0a256161e
--- /dev/null --- /dev/null
+++ b/src/main/java/co/aikar/timings/TimingsExport.java +++ b/src/main/java/co/aikar/timings/TimingsExport.java
@@ -0,0 +1,384 @@ @@ -0,0 +1,385 @@
+/* +/*
+ * This file is licensed under the MIT License (MIT). + * This file is licensed under the MIT License (MIT).
+ * + *
@ -194,6 +194,7 @@ index 0000000000000000000000000000000000000000..4092a227a540a1c5cfb95efcc2a36e04
+ +
+import com.google.common.collect.Sets; +import com.google.common.collect.Sets;
+import io.papermc.paper.adventure.PaperAdventure; +import io.papermc.paper.adventure.PaperAdventure;
+import net.kyori.adventure.text.event.ClickEvent;
+import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; +import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
+import net.minecraft.server.MinecraftServer; +import net.minecraft.server.MinecraftServer;
@ -511,7 +512,7 @@ index 0000000000000000000000000000000000000000..4092a227a540a1c5cfb95efcc2a36e04
+ } + }
+ +
+ timingsURL = con.getHeaderField("Location"); + timingsURL = con.getHeaderField("Location");
+ listeners.sendMessage(text("View Timings Report: " + timingsURL, NamedTextColor.GREEN)); + listeners.sendMessage(text("View Timings Report: ", NamedTextColor.GREEN).append(text(timingsURL).clickEvent(ClickEvent.clickEvent(ClickEvent.Action.OPEN_URL, timingsURL))));
+ +
+ if (response != null && !response.isEmpty()) { + if (response != null && !response.isEmpty()) {
+ Bukkit.getLogger().log(Level.INFO, "Timing Response: " + response); + Bukkit.getLogger().log(Level.INFO, "Timing Response: " + response);
@ -1877,7 +1878,7 @@ index b0ffa23faf62629043dfd613315eaf9c5fcc2cfe..00000000000000000000000000000000
- } - }
-} -}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 4c939de8822b064f0e44b741c4b3807ba13e5e9e..f43a728eba966992831d040a0ed96f5720d8d15c 100644 index 3ac1d0f7ad41ac66d6061fffe32efd7ea4757653..fcff5e05818c81f72cb6e0f83a683c2bb3979737 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2288,6 +2288,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2288,6 +2288,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {