Turn deprecation message into a Component
to be used in the command at a later date
This commit is contained in:
parent
32875b429a
commit
a13759afcc
1 changed files with 29 additions and 9 deletions
|
@ -1264,10 +1264,10 @@ index 0000000000000000000000000000000000000000..df142a89b8c43acb81eb383eac0ef048
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java
|
diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..c5ae86919e7ad8cc902405e34ddca633d6354e6b
|
index 0000000000000000000000000000000000000000..986d4e077759098bd49b76968d1600f99e26a13b
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/co/aikar/timings/Timings.java
|
+++ b/src/main/java/co/aikar/timings/Timings.java
|
||||||
@@ -0,0 +1,314 @@
|
@@ -0,0 +1,331 @@
|
||||||
+/*
|
+/*
|
||||||
+ * This file is licensed under the MIT License (MIT).
|
+ * This file is licensed under the MIT License (MIT).
|
||||||
+ *
|
+ *
|
||||||
|
@ -1296,6 +1296,10 @@ index 0000000000000000000000000000000000000000..c5ae86919e7ad8cc902405e34ddca633
|
||||||
+import com.google.common.base.Preconditions;
|
+import com.google.common.base.Preconditions;
|
||||||
+import com.google.common.collect.EvictingQueue;
|
+import com.google.common.collect.EvictingQueue;
|
||||||
+import com.google.common.collect.Lists;
|
+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.Bukkit;
|
||||||
+import org.bukkit.command.CommandSender;
|
+import org.bukkit.command.CommandSender;
|
||||||
+import org.bukkit.plugin.Plugin;
|
+import org.bukkit.plugin.Plugin;
|
||||||
|
@ -1418,15 +1422,28 @@ index 0000000000000000000000000000000000000000..c5ae86919e7ad8cc902405e34ddca633
|
||||||
+
|
+
|
||||||
+ private static void warnAboutDeprecationOnEnable() {
|
+ private static void warnAboutDeprecationOnEnable() {
|
||||||
+ if (timingsEnabled && !warnedAboutDeprecationOnEnable) {
|
+ if (timingsEnabled && !warnedAboutDeprecationOnEnable) {
|
||||||
+ Bukkit.getLogger().warning(String.join("\n",
|
+ Bukkit.getLogger().warning(PlainTextComponentSerializer.plainText().serialize(deprecationMessage()));
|
||||||
+ "[!] 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"
|
|
||||||
+ ));
|
|
||||||
+ warnedAboutDeprecationOnEnable = true;
|
+ 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>
|
+ * <p>Sets whether or not the Timings should monitor at Verbose level.</p>
|
||||||
+ *
|
+ *
|
||||||
|
@ -1584,10 +1601,10 @@ index 0000000000000000000000000000000000000000..c5ae86919e7ad8cc902405e34ddca633
|
||||||
+
|
+
|
||||||
diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java
|
diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..61cfad5cd53980836e1fd6ecf08a760166fff2b9
|
index 0000000000000000000000000000000000000000..e801e79fa57c44b2e5d359647c920f88064826f1
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/co/aikar/timings/TimingsCommand.java
|
+++ b/src/main/java/co/aikar/timings/TimingsCommand.java
|
||||||
@@ -0,0 +1,121 @@
|
@@ -0,0 +1,124 @@
|
||||||
+/*
|
+/*
|
||||||
+ * This file is licensed under the MIT License (MIT).
|
+ * This file is licensed under the MIT License (MIT).
|
||||||
+ *
|
+ *
|
||||||
|
@ -1644,6 +1661,9 @@ index 0000000000000000000000000000000000000000..61cfad5cd53980836e1fd6ecf08a7601
|
||||||
+ if (!testPermission(sender)) {
|
+ if (!testPermission(sender)) {
|
||||||
+ return true;
|
+ return true;
|
||||||
+ }
|
+ }
|
||||||
|
+ if (false) {
|
||||||
|
+ sender.sendMessage(Timings.deprecationMessage());
|
||||||
|
+ }
|
||||||
+ if (args.length < 1) {
|
+ if (args.length < 1) {
|
||||||
+ sender.sendMessage(text("Usage: " + this.usageMessage, NamedTextColor.RED));
|
+ sender.sendMessage(text("Usage: " + this.usageMessage, NamedTextColor.RED));
|
||||||
+ return true;
|
+ return true;
|
||||||
|
|
Loading…
Reference in a new issue