mirror of
https://github.com/SparklyPower/SparklyPaper.git
synced 2025-12-19 15:09:27 +00:00
80 lines
3.6 KiB
Diff
80 lines
3.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: MrPowerGamerBR <git@mrpowergamerbr.com>
|
|
Date: Thu, 23 Nov 2023 12:08:39 -0300
|
|
Subject: [PATCH] Parallel world ticking
|
|
|
|
|
|
diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java
|
|
index e81d0bc309de877ed2b5da6122f55c162e9b5f10..718cbe97a2bc0e415ffaaf0aaa174ac1fbe71b4f 100644
|
|
--- a/src/main/java/co/aikar/timings/Timings.java
|
|
+++ b/src/main/java/co/aikar/timings/Timings.java
|
|
@@ -55,6 +55,7 @@ public final class Timings {
|
|
private static int historyInterval = -1;
|
|
private static int historyLength = -1;
|
|
private static boolean warnedAboutDeprecationOnEnable;
|
|
+ private static boolean warnedAboutParallelWorldTickingOnEnable; // SparklyPaper - parallel world ticking
|
|
|
|
private Timings() {}
|
|
|
|
@@ -145,6 +146,12 @@ public final class Timings {
|
|
* @param enabled Should timings be reported
|
|
*/
|
|
public static void setTimingsEnabled(boolean enabled) {
|
|
+ // SparklyPaper - parallel world ticking
|
|
+ if (enabled) {
|
|
+ warnAboutParallelWorldTickingOnEnable();
|
|
+ return;
|
|
+ }
|
|
+ // SparklyPaper end
|
|
timingsEnabled = enabled;
|
|
warnAboutDeprecationOnEnable();
|
|
reset();
|
|
@@ -174,6 +181,34 @@ public final class Timings {
|
|
.build();
|
|
}
|
|
|
|
+ // SparklyPaper start - parallel world ticking
|
|
+ private static void warnAboutParallelWorldTickingOnEnable() {
|
|
+ if (!warnedAboutParallelWorldTickingOnEnable) {
|
|
+ Bukkit.getLogger().warning(PlainTextComponentSerializer.plainText().serialize(parallelWorldTickingMessage()));
|
|
+ warnedAboutParallelWorldTickingOnEnable = true;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public static Component parallelWorldTickingMessage() {
|
|
+ return Component.text()
|
|
+ .color(TextColor.color(0xf3ef91))
|
|
+ .append(Component.text("[!] The timings profiler attempted to be enabled, but was disabled because timings is not compatible with " + Bukkit.getName() + "'s Parallel World Ticking feature."))
|
|
+ .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(" Or, if you really need timings, get a build without the Parallel World Ticking feature")
|
|
+ )
|
|
+ .build();
|
|
+ }
|
|
+ // SparklyPaper end
|
|
+
|
|
/**
|
|
* <p>Sets whether or not the Timings should monitor at Verbose level.</p>
|
|
*
|
|
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
|
index 5df19bd701c67506689fc7f49d91f99ebfbc83f0..b38edfa6eca2138ebeffe8647b7b5c6b3206d85a 100644
|
|
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
|
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
|
@@ -39,7 +39,7 @@ public class SimpleCommandMap implements CommandMap {
|
|
register("bukkit", new VersionCommand("version"));
|
|
register("bukkit", new ReloadCommand("reload"));
|
|
//register("bukkit", new PluginsCommand("plugins")); // Paper
|
|
- register("bukkit", new co.aikar.timings.TimingsCommand("timings")); // Paper
|
|
+ // register("bukkit", new co.aikar.timings.TimingsCommand("timings")); // Paper // SparklyPaper - parallel world ticking
|
|
}
|
|
|
|
public void setFallbackCommands() {
|