mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2026-01-06 15:51:31 +00:00
Keep Timings class to fix plugin compatibility
This commit is contained in:
@@ -1277,60 +1277,39 @@ index df142a89b8c43acb81eb383eac0ef048a1f49a6e..00000000000000000000000000000000
|
||||
- }
|
||||
-}
|
||||
diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java
|
||||
deleted file mode 100644
|
||||
index 95b7cdf0677ef71e6885fa78aa5c75bb500f5f53..0000000000000000000000000000000000000000
|
||||
index 95b7cdf0677ef71e6885fa78aa5c75bb500f5f53..908b610bfdfe911675748211b74b809d9e0af3e5 100644
|
||||
--- a/src/main/java/co/aikar/timings/Timings.java
|
||||
+++ /dev/null
|
||||
@@ -1,325 +0,0 @@
|
||||
-/*
|
||||
- * This file is licensed under the MIT License (MIT).
|
||||
- *
|
||||
- * Copyright (c) 2014 Daniel Ennis <http://aikar.co>
|
||||
- *
|
||||
- * Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
- * of this software and associated documentation files (the "Software"), to deal
|
||||
- * in the Software without restriction, including without limitation the rights
|
||||
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
- * copies of the Software, and to permit persons to whom the Software is
|
||||
- * furnished to do so, subject to the following conditions:
|
||||
- *
|
||||
- * The above copyright notice and this permission notice shall be included in
|
||||
- * all copies or substantial portions of the Software.
|
||||
- *
|
||||
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
- * THE SOFTWARE.
|
||||
- */
|
||||
-package co.aikar.timings;
|
||||
-
|
||||
+++ b/src/main/java/co/aikar/timings/Timings.java
|
||||
@@ -23,303 +23,48 @@
|
||||
*/
|
||||
package co.aikar.timings;
|
||||
|
||||
-import com.google.common.base.Preconditions;
|
||||
-import com.google.common.collect.EvictingQueue;
|
||||
-import com.google.common.collect.Lists;
|
||||
-import net.kyori.adventure.text.Component;
|
||||
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.command.CommandSender;
|
||||
import org.bukkit.command.CommandSender;
|
||||
-import org.bukkit.plugin.Plugin;
|
||||
-
|
||||
|
||||
-import java.util.List;
|
||||
-import java.util.Queue;
|
||||
-import java.util.logging.Level;
|
||||
-import org.jetbrains.annotations.NotNull;
|
||||
-import org.jetbrains.annotations.Nullable;
|
||||
-
|
||||
-/**
|
||||
- * @deprecated Timings will be removed in the future
|
||||
- */
|
||||
-@Deprecated(forRemoval = true)
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
+// Leaf start - Remove Timings
|
||||
/**
|
||||
* @deprecated Timings will be removed in the future
|
||||
+ * Keep this class for plugin compatibility (detect usage)
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
-@SuppressWarnings({"UnusedDeclaration", "WeakerAccess", "SameParameterValue"})
|
||||
-public final class Timings {
|
||||
-
|
||||
public final class Timings {
|
||||
|
||||
- final static List<CommandSender> requestingReport = Lists.newArrayList();
|
||||
- private static final int MAX_HISTORY_FRAMES = 12;
|
||||
- public static final Timing NULL_HANDLER = new NullTimingHandler();
|
||||
@@ -1340,8 +1319,8 @@ index 95b7cdf0677ef71e6885fa78aa5c75bb500f5f53..00000000000000000000000000000000
|
||||
- private static int historyLength = -1;
|
||||
- private static boolean warnedAboutDeprecationOnEnable;
|
||||
-
|
||||
- private Timings() {}
|
||||
-
|
||||
private Timings() {}
|
||||
|
||||
- /**
|
||||
- * Returns a Timing for a plugin corresponding to a name.
|
||||
- *
|
||||
@@ -1417,9 +1396,10 @@ index 95b7cdf0677ef71e6885fa78aa5c75bb500f5f53..00000000000000000000000000000000
|
||||
- *
|
||||
- * @return Enabled or not
|
||||
- */
|
||||
- public static boolean isTimingsEnabled() {
|
||||
public static boolean isTimingsEnabled() {
|
||||
- return timingsEnabled;
|
||||
- }
|
||||
+ return false;
|
||||
}
|
||||
-
|
||||
- /**
|
||||
- * <p>Sets whether or not the Spigot Timings system should be enabled</p>
|
||||
@@ -1428,14 +1408,14 @@ index 95b7cdf0677ef71e6885fa78aa5c75bb500f5f53..00000000000000000000000000000000
|
||||
- *
|
||||
- * @param enabled Should timings be reported
|
||||
- */
|
||||
- public static void setTimingsEnabled(boolean enabled) {
|
||||
public static void setTimingsEnabled(boolean enabled) {
|
||||
- if (enabled && !warnedAboutDeprecationOnEnable) {
|
||||
- Bukkit.getLogger().severe(PlainTextComponentSerializer.plainText().serialize(deprecationMessage()));
|
||||
- warnedAboutDeprecationOnEnable = true;
|
||||
- }
|
||||
- }
|
||||
}
|
||||
-
|
||||
- public static Component deprecationMessage() {
|
||||
public static Component deprecationMessage() {
|
||||
- return Component.text()
|
||||
- .color(TextColor.color(0xffc93a))
|
||||
- .append(Component.text("[!] The timings profiler is in no-op mode and will be fully removed in a later update."))
|
||||
@@ -1450,7 +1430,8 @@ index 95b7cdf0677ef71e6885fa78aa5c75bb500f5f53..00000000000000000000000000000000
|
||||
- .clickEvent(ClickEvent.openUrl("https://github.com/PaperMC/Paper/discussions/10565")))
|
||||
- )
|
||||
- .build();
|
||||
- }
|
||||
+ return Component.empty();
|
||||
}
|
||||
-
|
||||
- /**
|
||||
- * <p>Sets whether or not the Timings should monitor at Verbose level.</p>
|
||||
@@ -1459,9 +1440,10 @@ index 95b7cdf0677ef71e6885fa78aa5c75bb500f5f53..00000000000000000000000000000000
|
||||
- *
|
||||
- * @return Enabled or not
|
||||
- */
|
||||
- public static boolean isVerboseTimingsEnabled() {
|
||||
public static boolean isVerboseTimingsEnabled() {
|
||||
- return verboseEnabled;
|
||||
- }
|
||||
+ return false;
|
||||
}
|
||||
-
|
||||
- /**
|
||||
- * <p>Sets whether or not the Timings should monitor at Verbose level.</p>
|
||||
@@ -1471,10 +1453,10 @@ index 95b7cdf0677ef71e6885fa78aa5c75bb500f5f53..00000000000000000000000000000000
|
||||
- *
|
||||
- * @param enabled Should high-frequency timings be reported
|
||||
- */
|
||||
- public static void setVerboseTimingsEnabled(boolean enabled) {
|
||||
public static void setVerboseTimingsEnabled(boolean enabled) {
|
||||
- verboseEnabled = enabled;
|
||||
- TimingsManager.needsRecheckEnabled = true;
|
||||
- }
|
||||
}
|
||||
-
|
||||
- /**
|
||||
- * <p>Gets the interval between Timing History report generation.</p>
|
||||
@@ -1483,9 +1465,10 @@ index 95b7cdf0677ef71e6885fa78aa5c75bb500f5f53..00000000000000000000000000000000
|
||||
- *
|
||||
- * @return Interval in ticks
|
||||
- */
|
||||
- public static int getHistoryInterval() {
|
||||
public static int getHistoryInterval() {
|
||||
- return historyInterval;
|
||||
- }
|
||||
+ return 0;
|
||||
}
|
||||
-
|
||||
- /**
|
||||
- * <p>Sets the interval between Timing History report generations.</p>
|
||||
@@ -1497,13 +1480,13 @@ index 95b7cdf0677ef71e6885fa78aa5c75bb500f5f53..00000000000000000000000000000000
|
||||
- *
|
||||
- * @param interval Interval in ticks
|
||||
- */
|
||||
- public static void setHistoryInterval(int interval) {
|
||||
public static void setHistoryInterval(int interval) {
|
||||
- historyInterval = Math.max(20*60, interval);
|
||||
- // Recheck the history length with the new Interval
|
||||
- if (historyLength != -1) {
|
||||
- setHistoryLength(historyLength);
|
||||
- }
|
||||
- }
|
||||
}
|
||||
-
|
||||
- /**
|
||||
- * Gets how long in ticks Timings history is kept for the server.
|
||||
@@ -1512,9 +1495,10 @@ index 95b7cdf0677ef71e6885fa78aa5c75bb500f5f53..00000000000000000000000000000000
|
||||
- *
|
||||
- * @return Duration in Ticks
|
||||
- */
|
||||
- public static int getHistoryLength() {
|
||||
public static int getHistoryLength() {
|
||||
- return historyLength;
|
||||
- }
|
||||
+ return 0;
|
||||
}
|
||||
-
|
||||
- /**
|
||||
- * Sets how long Timing History reports are kept for the server.
|
||||
@@ -1527,7 +1511,7 @@ index 95b7cdf0677ef71e6885fa78aa5c75bb500f5f53..00000000000000000000000000000000
|
||||
- *
|
||||
- * @param length Duration in ticks
|
||||
- */
|
||||
- public static void setHistoryLength(int length) {
|
||||
public static void setHistoryLength(int length) {
|
||||
- // Cap at 12 History Frames, 1 hour at 5 minute frames.
|
||||
- int maxLength = historyInterval * MAX_HISTORY_FRAMES;
|
||||
- // For special cases of servers with special permission to bypass the max.
|
||||
@@ -1544,14 +1528,14 @@ index 95b7cdf0677ef71e6885fa78aa5c75bb500f5f53..00000000000000000000000000000000
|
||||
- }
|
||||
- TimingsManager.HISTORY = EvictingQueue.create(frames);
|
||||
- TimingsManager.HISTORY.addAll(oldQueue);
|
||||
- }
|
||||
}
|
||||
-
|
||||
- /**
|
||||
- * Resets all Timing Data
|
||||
- */
|
||||
- public static void reset() {
|
||||
public static void reset() {
|
||||
- TimingsManager.reset();
|
||||
- }
|
||||
}
|
||||
-
|
||||
- /**
|
||||
- * Generates a report and sends it to the specified command sender.
|
||||
@@ -1559,7 +1543,7 @@ index 95b7cdf0677ef71e6885fa78aa5c75bb500f5f53..00000000000000000000000000000000
|
||||
- * If sender is null, ConsoleCommandSender will be used.
|
||||
- * @param sender The sender to send to, or null to use the ConsoleCommandSender
|
||||
- */
|
||||
- public static void generateReport(@Nullable CommandSender sender) {
|
||||
public static void generateReport(@Nullable CommandSender sender) {
|
||||
- if (sender == null) {
|
||||
- sender = Bukkit.getConsoleSender();
|
||||
- }
|
||||
@@ -1604,9 +1588,10 @@ index 95b7cdf0677ef71e6885fa78aa5c75bb500f5f53..00000000000000000000000000000000
|
||||
- @NotNull
|
||||
- static TimingHandler ofSafe(@Nullable String groupName, @NotNull String name, @Nullable Timing groupHandler) {
|
||||
- return TimingsManager.getHandler(groupName, name, groupHandler);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
}
|
||||
+ // Leaf end - Remove Timings
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java
|
||||
deleted file mode 100644
|
||||
index b83e5ff7ada8771fdf27ba9807c77ba6a4ce12da..0000000000000000000000000000000000000000
|
||||
@@ -2834,37 +2819,6 @@ index 3e61a926620a67daec3af54b72a1b911eaef2ed4..00000000000000000000000000000000
|
||||
- return new MRUMapCache<K, V>(map);
|
||||
- }
|
||||
-}
|
||||
diff --git a/src/main/java/org/bukkit/command/BufferedCommandSender.java b/src/main/java/org/bukkit/command/BufferedCommandSender.java
|
||||
deleted file mode 100644
|
||||
index 45ed63797b13e114bf3795c80a6c3967d8eb2351..0000000000000000000000000000000000000000
|
||||
--- a/src/main/java/org/bukkit/command/BufferedCommandSender.java
|
||||
+++ /dev/null
|
||||
@@ -1,25 +0,0 @@
|
||||
-package org.bukkit.command;
|
||||
-
|
||||
-import org.jetbrains.annotations.NotNull;
|
||||
-
|
||||
-/**
|
||||
- * @deprecated Timings will be removed in the future
|
||||
- */
|
||||
-@Deprecated(forRemoval = true)
|
||||
-public class BufferedCommandSender implements MessageCommandSender {
|
||||
- private final StringBuffer buffer = new StringBuffer();
|
||||
- @Override
|
||||
- public void sendMessage(@NotNull String message) {
|
||||
- buffer.append(message);
|
||||
- buffer.append("\n");
|
||||
- }
|
||||
-
|
||||
- @NotNull
|
||||
- public String getBuffer() {
|
||||
- return buffer.toString();
|
||||
- }
|
||||
-
|
||||
- public void reset() {
|
||||
- this.buffer.setLength(0);
|
||||
- }
|
||||
-}
|
||||
diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java
|
||||
index 71eb845a4d3b8b6ec3b816a0f20ec807e0f9a86d..a43419c23aa0f6fd809caf5a841cb138f350b7ba 100644
|
||||
--- a/src/main/java/org/bukkit/command/Command.java
|
||||
@@ -3046,26 +3000,34 @@ index 2fae50a9d1f0d9ecd91036697dedd64bc56f7d3b..bf299cfe88c383d489de0c36fd9a4922
|
||||
return ret;
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java
|
||||
index 5fbacfcf108432c5187aa9a4092d00d7d5b0fd53..735e8f8591fec1d7108ac020cb2ddcf99577bce1 100644
|
||||
index 5fbacfcf108432c5187aa9a4092d00d7d5b0fd53..1a2949d872c8acd3c30c403ef7d8674fe086751c 100644
|
||||
--- a/src/main/java/org/spigotmc/CustomTimingsHandler.java
|
||||
+++ b/src/main/java/org/spigotmc/CustomTimingsHandler.java
|
||||
@@ -26,9 +26,6 @@ package org.spigotmc;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -23,45 +23,20 @@
|
||||
*/
|
||||
package org.spigotmc;
|
||||
|
||||
-import org.bukkit.Bukkit;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.bukkit.plugin.AuthorNagException;
|
||||
-import org.bukkit.plugin.AuthorNagException;
|
||||
-import co.aikar.timings.Timing;
|
||||
-import co.aikar.timings.Timings;
|
||||
-import co.aikar.timings.TimingsManager;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.logging.Level;
|
||||
@@ -39,29 +36,16 @@ import java.util.logging.Level;
|
||||
* If you use this, migrate ASAP as this will be removed in the future!
|
||||
*
|
||||
* @deprecated
|
||||
- * @see co.aikar.timings.Timings#of
|
||||
*/
|
||||
-
|
||||
-import java.lang.reflect.Method;
|
||||
-import java.util.logging.Level;
|
||||
-
|
||||
+// Leaf start - Remove Timings
|
||||
/**
|
||||
- * This is here for legacy purposes incase any plugin used it.
|
||||
- *
|
||||
- * If you use this, migrate ASAP as this will be removed in the future!
|
||||
- *
|
||||
- * @deprecated
|
||||
- * @see co.aikar.timings.Timings#of
|
||||
+ * @deprecated Timings will be removed in the future
|
||||
+ * Keep this class for plugin compatibility (detect usage)
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public final class CustomTimingsHandler {
|
||||
- private final Timing handler;
|
||||
|
||||
Reference in New Issue
Block a user