9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00

Update changes from ver/1.21.4 branch

This commit is contained in:
Dreeam
2025-05-24 14:14:34 +08:00
95 changed files with 4201 additions and 3563 deletions

View File

@@ -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
@@ -2831,37 +2816,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 27a7c69f23084e821d945d5e97e51a94ddd94e58..d645ee8470a2dd9f7b8eff2b7ff2211aba9c342f 100644
--- a/src/main/java/org/bukkit/command/Command.java
@@ -3017,38 +2971,15 @@ index ce45dbc7b02c405f1b3460563cf87e7888702ba9..c43ce5b7bed3297cd655a7f2ed4b4717
}
return ret;
diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java
deleted file mode 100644
index 5fbacfcf108432c5187aa9a4092d00d7d5b0fd53..0000000000000000000000000000000000000000
index 5fbacfcf108432c5187aa9a4092d00d7d5b0fd53..68e2a332e512a4aea45b8fb33a6e34431548d3be 100644
--- a/src/main/java/org/spigotmc/CustomTimingsHandler.java
+++ /dev/null
@@ -1,67 +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 org.spigotmc;
-
+++ b/src/main/java/org/spigotmc/CustomTimingsHandler.java
@@ -23,45 +23,20 @@
*/
package org.spigotmc;
-import org.bukkit.Bukkit;
-import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.NotNull;
-import org.bukkit.plugin.AuthorNagException;
-import co.aikar.timings.Timing;
-import co.aikar.timings.Timings;
@@ -3056,20 +2987,23 @@ index 5fbacfcf108432c5187aa9a4092d00d7d5b0fd53..00000000000000000000000000000000
-
-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(forRemoval = true)
-public final class CustomTimingsHandler {
+ * @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;
-
- public CustomTimingsHandler(@NotNull String name) {
public CustomTimingsHandler(@NotNull String name) {
- Timing timing;
-
- new AuthorNagException("Deprecated use of CustomTimingsHandler. Timings has been removed.").printStackTrace();
@@ -3083,12 +3017,15 @@ index 5fbacfcf108432c5187aa9a4092d00d7d5b0fd53..00000000000000000000000000000000
- timing = Timings.NULL_HANDLER;
- }
- handler = timing;
- }
-
}
- public void startTiming() { handler.startTiming(); }
- public void stopTiming() { handler.stopTiming(); }
-
-}
+ public void startTiming() {}
+ public void stopTiming() {}
+ // Leaf end - Remove Timings
}
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
index 37feafd626aaa17aba888d7ff13728b3c6f26d4d..e42619418c1a3e3dac22e7310bb9d64b42b9f6a7 100644
--- a/src/test/java/org/bukkit/AnnotationTest.java