Remove leftover missed timings calls (#11527)

* remove leftover timings calls

* remove unused imports
This commit is contained in:
granny 2024-10-28 00:03:55 -07:00 committed by GitHub
parent e35f199344
commit 6288adb001
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1858,13 +1858,12 @@ index 0000000000000000000000000000000000000000..5eef7ae5197bd395fbd6800530ffe34d
+} +}
diff --git a/src/main/java/io/papermc/paper/command/brigadier/bukkit/BukkitCommandNode.java b/src/main/java/io/papermc/paper/command/brigadier/bukkit/BukkitCommandNode.java diff --git a/src/main/java/io/papermc/paper/command/brigadier/bukkit/BukkitCommandNode.java b/src/main/java/io/papermc/paper/command/brigadier/bukkit/BukkitCommandNode.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..0c3c82b28e581286b798ee58ca4193efc2faff4a index 0000000000000000000000000000000000000000..1814cd072aaca3e72249f0509a9c3b3cb154eaba
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/command/brigadier/bukkit/BukkitCommandNode.java +++ b/src/main/java/io/papermc/paper/command/brigadier/bukkit/BukkitCommandNode.java
@@ -0,0 +1,148 @@ @@ -0,0 +1,138 @@
+package io.papermc.paper.command.brigadier.bukkit; +package io.papermc.paper.command.brigadier.bukkit;
+ +
+import co.aikar.timings.Timing;
+import com.mojang.brigadier.arguments.StringArgumentType; +import com.mojang.brigadier.arguments.StringArgumentType;
+import com.mojang.brigadier.builder.RequiredArgumentBuilder; +import com.mojang.brigadier.builder.RequiredArgumentBuilder;
+import com.mojang.brigadier.context.CommandContext; +import com.mojang.brigadier.context.CommandContext;
@ -1875,7 +1874,6 @@ index 0000000000000000000000000000000000000000..0c3c82b28e581286b798ee58ca4193ef
+import com.mojang.brigadier.tree.LiteralCommandNode; +import com.mojang.brigadier.tree.LiteralCommandNode;
+import io.papermc.paper.command.brigadier.CommandSourceStack; +import io.papermc.paper.command.brigadier.CommandSourceStack;
+import java.util.ArrayList; +import java.util.ArrayList;
+import java.util.Collections;
+import net.minecraft.commands.CommandSource; +import net.minecraft.commands.CommandSource;
+import org.bukkit.Bukkit; +import org.bukkit.Bukkit;
+import org.bukkit.ChatColor; +import org.bukkit.ChatColor;
@ -1888,7 +1886,6 @@ index 0000000000000000000000000000000000000000..0c3c82b28e581286b798ee58ca4193ef
+import java.util.List; +import java.util.List;
+import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletableFuture;
+import java.util.logging.Level; +import java.util.logging.Level;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player; +import org.bukkit.entity.Player;
+import org.bukkit.event.server.TabCompleteEvent; +import org.bukkit.event.server.TabCompleteEvent;
+ +
@ -1942,18 +1939,11 @@ index 0000000000000000000000000000000000000000..0c3c82b28e581286b798ee58ca4193ef
+ public int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException { + public int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
+ CommandSender sender = context.getSource().getSender(); + CommandSender sender = context.getSource().getSender();
+ +
+ // Plugins do weird things to workaround normal registration
+ if (this.command.timings == null) {
+ this.command.timings = co.aikar.timings.TimingsManager.getCommandTiming(null, this.command);
+ }
+
+ String content = context.getRange().get(context.getInput()); + String content = context.getRange().get(context.getInput());
+ String[] args = org.apache.commons.lang3.StringUtils.split(content, ' '); // fix adjacent spaces (from console/plugins) causing empty array elements + String[] args = org.apache.commons.lang3.StringUtils.split(content, ' '); // fix adjacent spaces (from console/plugins) causing empty array elements
+ +
+ try (Timing ignored = this.command.timings.startTiming()) {
+ // Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false) + // Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false)
+ this.command.execute(sender, this.literal, Arrays.copyOfRange(args, 1, args.length)); + this.command.execute(sender, this.literal, Arrays.copyOfRange(args, 1, args.length));
+ }
+ +
+ // return true as command was handled + // return true as command was handled
+ return 1; + return 1;