Cleanup/command dispatching (#12713)

This commit is contained in:
Owen
2025-06-21 21:44:07 -04:00
committed by GitHub
parent 186e9e331b
commit 5edcf6ddf6
10 changed files with 97 additions and 124 deletions

View File

@ -12,12 +12,18 @@
public int getSuccessCount() {
return this.successCount;
@@ -108,7 +_,7 @@
@@ -108,7 +_,13 @@
this.successCount++;
}
});
- server.getCommands().performPrefixedCommand(commandSourceStack, this.command);
+ server.getCommands().dispatchServerCommand(commandSourceStack, this.command); // CraftBukkit
+ // Paper start - ServerCommandEvent
+ org.bukkit.event.server.ServerCommandEvent event = new org.bukkit.event.server.ServerCommandEvent(commandSourceStack.getBukkitSender(), net.minecraft.commands.Commands.trimOptionalPrefix(this.command));
+ if (!event.callEvent()) {
+ return true;
+ }
+ server.getCommands().performPrefixedCommand(commandSourceStack, event.getCommand());
+ // Paper end - ServerCommandEvent
} catch (Throwable var6) {
CrashReport crashReport = CrashReport.forThrowable(var6, "Executing command block");
CrashReportCategory crashReportCategory = crashReport.addCategory("Command to be executed");