13
0
geforkt von Mirrors/Paper

Turn deprecation message into a Component to be used in the command at a later date

Dieser Commit ist enthalten in:
Riley Park 2023-03-29 19:11:50 -07:00
Ursprung 90a88fcc04
Commit d6d0bad512

Datei anzeigen

@ -1296,6 +1296,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import com.google.common.base.Preconditions;
+import com.google.common.collect.EvictingQueue;
+import com.google.common.collect.Lists;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.event.ClickEvent;
+import net.kyori.adventure.text.format.TextColor;
+import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
+import org.bukkit.Bukkit;
+import org.bukkit.command.CommandSender;
+import org.bukkit.plugin.Plugin;
@ -1418,15 +1422,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ private static void warnAboutDeprecationOnEnable() {
+ if (timingsEnabled && !warnedAboutDeprecationOnEnable) {
+ Bukkit.getLogger().warning(String.join("\n",
+ "[!] The timings system has been enabled but has been scheduled for removal from Paper in the future.",
+ " We recommend installing the spark profiler as a replacement: https://spark.lucko.me/",
+ " For more information please visit: https://github.com/PaperMC/Paper/issues/8948"
+ ));
+ Bukkit.getLogger().warning(PlainTextComponentSerializer.plainText().serialize(deprecationMessage()));
+ warnedAboutDeprecationOnEnable = true;
+ }
+ }
+
+ public static Component deprecationMessage() {
+ return Component.text()
+ .color(TextColor.color(0xf3ef91))
+ .append(Component.text("[!] The timings profiler has been enabled but has been scheduled for removal from Paper in the future."))
+ .append(Component.newline())
+ .append(
+ Component.text(" We recommend installing the spark profiler as a replacement: ")
+ .append(
+ Component.text()
+ .content("https://spark.lucko.me/")
+ .clickEvent(ClickEvent.openUrl("https://spark.lucko.me/")))
+ )
+ .append(Component.newline())
+ .append(Component.text(" For more information please visit: https://github.com/PaperMC/Paper/issues/8948"))
+ .build();
+ }
+
+ /**
+ * <p>Sets whether or not the Timings should monitor at Verbose level.</p>
+ *
@ -1644,6 +1661,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (!testPermission(sender)) {
+ return true;
+ }
+ if (false) {
+ sender.sendMessage(Timings.deprecationMessage());
+ }
+ if (args.length < 1) {
+ sender.sendMessage(text("Usage: " + this.usageMessage, NamedTextColor.RED));
+ return true;