Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Commit 69b42fb

Browse files
BillyGalbreathgranny
authored andcommitted
Remove Timings
1 parent c544757 commit 69b42fb

7 files changed

Lines changed: 136 additions & 162 deletions

File tree

patches/api/0035-Remove-Timings.patch

Lines changed: 0 additions & 159 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--- a/src/main/java/co/aikar/timings/TimedEventExecutor.java
2+
+++ b/src/main/java/co/aikar/timings/TimedEventExecutor.java
3+
@@ -80,9 +_,9 @@
4+
executor.execute(listener, event);
5+
return;
6+
}
7+
- try (Timing ignored = timings.startTiming()){
8+
+ //try (Timing ignored = timings.startTiming()){ // Purpur - Remove Timings
9+
executor.execute(listener, event);
10+
- }
11+
+ //} // Purpur - Remove Timings
12+
}
13+
14+
@Override
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
--- a/src/main/java/co/aikar/timings/Timing.java
2+
+++ b/src/main/java/co/aikar/timings/Timing.java
3+
@@ -39,6 +_,7 @@
4+
* @return Timing
5+
*/
6+
@NotNull
7+
+ @io.papermc.paper.annotation.DoNotUse // Purpur - Remove Timings
8+
Timing startTiming();
9+
10+
/**
11+
@@ -46,6 +_,7 @@
12+
*
13+
* Will automatically be called when this Timing is used with try-with-resources
14+
*/
15+
+ @io.papermc.paper.annotation.DoNotUse // Purpur - Remove Timings
16+
void stopTiming();
17+
18+
/**
19+
@@ -56,6 +_,7 @@
20+
* @return Timing
21+
*/
22+
@NotNull
23+
+ @io.papermc.paper.annotation.DoNotUse // Purpur - Remove Timings
24+
Timing startTimingIfSync();
25+
26+
/**
27+
@@ -65,12 +_,14 @@
28+
*
29+
* But only if we are on the primary thread.
30+
*/
31+
+ @io.papermc.paper.annotation.DoNotUse // Purpur - Remove Timings
32+
void stopTimingIfSync();
33+
34+
/**
35+
* @deprecated Doesn't do anything - Removed
36+
*/
37+
@Deprecated
38+
+ @io.papermc.paper.annotation.DoNotUse // Purpur - Remove Timings
39+
void abort();
40+
41+
/**
42+
@@ -82,5 +_,6 @@
43+
TimingHandler getTimingHandler();
44+
45+
@Override
46+
+ @io.papermc.paper.annotation.DoNotUse // Purpur - Remove Timings
47+
void close();
48+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--- a/src/main/java/co/aikar/timings/Timings.java
2+
+++ b/src/main/java/co/aikar/timings/Timings.java
3+
@@ -124,7 +_,7 @@
4+
@NotNull
5+
public static Timing ofStart(@NotNull Plugin plugin, @NotNull String name, @Nullable Timing groupHandler) {
6+
Timing timing = of(plugin, name, groupHandler);
7+
- timing.startTiming();
8+
+ //timing.startTiming(); // Purpur - Remove Timings
9+
return timing;
10+
}
11+
12+
@@ -146,7 +_,7 @@
13+
*/
14+
public static void setTimingsEnabled(boolean enabled) {
15+
if (enabled && !warnedAboutDeprecationOnEnable) {
16+
- Bukkit.getLogger().severe(PlainTextComponentSerializer.plainText().serialize(deprecationMessage()));
17+
+ //Bukkit.getLogger().severe(PlainTextComponentSerializer.plainText().serialize(deprecationMessage())); // Purpur - Remove Timings
18+
warnedAboutDeprecationOnEnable = true;
19+
}
20+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
--- a/src/main/java/co/aikar/timings/TimingsCommand.java
2+
+++ b/src/main/java/co/aikar/timings/TimingsCommand.java
3+
@@ -47,7 +_,7 @@
4+
public TimingsCommand(@NotNull String name) {
5+
super(name);
6+
this.description = "Manages Spigot Timings data to see performance of the server.";
7+
- this.usageMessage = "/timings <reset|report|on|off|verbon|verboff>";
8+
+ this.usageMessage = "/timings";// <reset|report|on|off|verbon|verboff>"; // Purpur - Remove Timings
9+
this.setPermission("bukkit.command.timings");
10+
}
11+
12+
@@ -57,7 +_,12 @@
13+
return true;
14+
}
15+
if (true) {
16+
- sender.sendMessage(Timings.deprecationMessage());
17+
+ // Purpur start - Remove Timings
18+
+ net.kyori.adventure.text.minimessage.MiniMessage mm = net.kyori.adventure.text.minimessage.MiniMessage.miniMessage();
19+
+ sender.sendMessage(mm.deserialize("<gold>Purpur has removed timings to save your performance. Please use <click:suggest_command:'/spark'><grey>/spark</grey></click> instead"));
20+
+ sender.sendMessage(mm.deserialize("<gold>For more information, view its documentation at"));
21+
+ sender.sendMessage(mm.deserialize("<gold><click:open_url:'https://spark.lucko.me/docs/Command-Usage'>https://spark.lucko.me/docs/Command-Usage</click>"));
22+
+ // Purpur end - Remove Timings
23+
return true;
24+
}
25+
if (args.length < 1) {
26+
@@ -118,7 +_,7 @@
27+
Preconditions.checkNotNull(args, "Arguments cannot be null");
28+
Preconditions.checkNotNull(alias, "Alias cannot be null");
29+
30+
- if (args.length == 1) {
31+
+ if (false && args.length == 1) { // Purpur - Remove Timings
32+
return StringUtil.copyPartialMatches(args[0], TIMINGS_SUBCOMMANDS,
33+
new ArrayList<String>(TIMINGS_SUBCOMMANDS.size()));
34+
}

purpur-api/paper-patches/files/src/main/java/org/bukkit/command/SimpleCommandMap.java.patch

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,17 @@
2020
// Paper start - Plugins do weird things to workaround normal registration
2121
if (target.timings == null) {
2222
target.timings = co.aikar.timings.TimingsManager.getCommandTiming(null, target);
23-
@@ -162,7 +_,7 @@
23+
@@ -160,10 +_,10 @@
24+
// Paper end
25+
2426
try {
25-
try (co.aikar.timings.Timing ignored = target.timings.startTiming()) { // Paper - use try with resources
27+
- try (co.aikar.timings.Timing ignored = target.timings.startTiming()) { // Paper - use try with resources
28+
+ //try (co.aikar.timings.Timing ignored = target.timings.startTiming()) { // Paper - use try with resources // Purpur - Remove Timings
2629
// Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false)
2730
- target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length));
31+
- } // target.timings.stopTiming(); // Spigot // Paper
2832
+ target.execute(sender, sentCommandLabel, parsedArgs); // Purpur - ExecuteCommandEvent
29-
} // target.timings.stopTiming(); // Spigot // Paper
33+
+ //} // target.timings.stopTiming(); // Spigot // Paper // Purpur - Remove Timings
3034
} catch (CommandException ex) {
3135
server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerCommandException(ex, target, sender, args))); // Paper
36+
//target.timings.stopTiming(); // Spigot // Paper
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--- a/src/main/java/org/spigotmc/CustomTimingsHandler.java
2+
+++ b/src/main/java/org/spigotmc/CustomTimingsHandler.java
3+
@@ -61,7 +_,7 @@
4+
handler = timing;
5+
}
6+
7+
- public void startTiming() { handler.startTiming(); }
8+
- public void stopTiming() { handler.stopTiming(); }
9+
+ public void startTiming() { /*handler.startTiming();*/ } // Purpur - Remove Timings
10+
+ public void stopTiming() { /*handler.stopTiming();*/ } // Purpur - Remove Timings
11+
12+
}

0 commit comments

Comments
 (0)