Notify users that Timings cannot be enabled on Folia

This commit is contained in:
Riley Park 2023-03-29 18:30:45 -07:00
parent 00864ac5b1
commit f3e6529d49
1 changed files with 36 additions and 2 deletions

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Force disable timings
Need a new profiler system with region threading
diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java
index c5ae86919e7ad8cc902405e34ddca633d6354e6b..85536ea8dc7943415c8cdb3c2c175ac2d21f7a90 100644
index b5a86274925a9285f8f20ed7c54877207804419c..fdf5111c3ccd738c4380b517f64082c387b48469 100644
--- a/src/main/java/co/aikar/timings/Timings.java
+++ b/src/main/java/co/aikar/timings/Timings.java
@@ -141,6 +141,7 @@ public final class Timings {
@@ -145,13 +145,14 @@ public final class Timings {
* @param enabled Should timings be reported
*/
public static void setTimingsEnabled(boolean enabled) {
@ -17,3 +17,37 @@ index c5ae86919e7ad8cc902405e34ddca633d6354e6b..85536ea8dc7943415c8cdb3c2c175ac2
timingsEnabled = enabled;
warnAboutDeprecationOnEnable();
reset();
}
private static void warnAboutDeprecationOnEnable() {
- if (timingsEnabled && !warnedAboutDeprecationOnEnable) {
+ if ((true || timingsEnabled) && !warnedAboutDeprecationOnEnable) { // Folia
Bukkit.getLogger().warning(PlainTextComponentSerializer.plainText().serialize(deprecationMessage()));
warnedAboutDeprecationOnEnable = true;
}
@@ -159,8 +160,8 @@ public final class Timings {
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."))
+ .color(TextColor.color(0xf39195)) // Folia
+ .append(Component.text("[!] The timings system cannot be enabled on Folia, and has been scheduled for removal from Paper in the future.")) // Folia
.append(Component.newline())
.append(
Component.text(" We recommend installing the spark profiler as a replacement: ")
diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java
index e801e79fa57c44b2e5d359647c920f88064826f1..d897b92311da36b21561e95f1530016d1579facc 100644
--- a/src/main/java/co/aikar/timings/TimingsCommand.java
+++ b/src/main/java/co/aikar/timings/TimingsCommand.java
@@ -54,8 +54,9 @@ public class TimingsCommand extends BukkitCommand {
if (!testPermission(sender)) {
return true;
}
- if (false) {
+ if (true) {
sender.sendMessage(Timings.deprecationMessage());
+ return true;
}
if (args.length < 1) {
sender.sendMessage(text("Usage: " + this.usageMessage, NamedTextColor.RED));