mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 05:47:45 +01:00
8948: Nag when timings is enabled or a plugin creates a new Timing
This commit is contained in:
parent
7c76b259a5
commit
90a88fcc04
@ -1320,6 +1320,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ static boolean verboseEnabled = false;
|
||||
+ private static int historyInterval = -1;
|
||||
+ private static int historyLength = -1;
|
||||
+ private static boolean warnedAboutDeprecationOnEnable;
|
||||
+
|
||||
+ private Timings() {}
|
||||
+
|
||||
@ -1354,6 +1355,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ @NotNull
|
||||
+ public static Timing of(@NotNull Plugin plugin, @NotNull String name, @Nullable Timing groupHandler) {
|
||||
+ Preconditions.checkNotNull(plugin, "Plugin can not be null");
|
||||
+ Bukkit.getLogger().warning(String.format("Plugin '%s' is creating timing '%s' - this is deprecated behavior, please report it to the authors: %s", plugin.getName(), name, String.join(", ", plugin.getDescription().getAuthors())));
|
||||
+ return TimingsManager.getHandler(plugin.getName(), name, groupHandler);
|
||||
+ }
|
||||
+
|
||||
@ -1410,9 +1412,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ */
|
||||
+ public static void setTimingsEnabled(boolean enabled) {
|
||||
+ timingsEnabled = enabled;
|
||||
+ warnAboutDeprecationOnEnable();
|
||||
+ reset();
|
||||
+ }
|
||||
+
|
||||
+ 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"
|
||||
+ ));
|
||||
+ warnedAboutDeprecationOnEnable = true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * <p>Sets whether or not the Timings should monitor at Verbose level.</p>
|
||||
+ *
|
||||
|
Loading…
Reference in New Issue
Block a user