Folia/patches/api/0001-Force-disable-timings.patch

54 lines
2.7 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Thu, 23 Feb 2023 20:12:48 -0800
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 9812d668ad945aba486fbf6d5bf83c4292cb5d03..34386d6ce702de9a58f2892045563dd57ef46bbf 100644
--- a/src/main/java/co/aikar/timings/Timings.java
+++ b/src/main/java/co/aikar/timings/Timings.java
@@ -145,13 +145,14 @@ public final class Timings {
* @param enabled Should timings be reported
*/
public static void setTimingsEnabled(boolean enabled) {
+ enabled = false; // Folia - region threading - disable timings
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));