Skip to content

Commit c10d571

Browse files
committed
Copy forward when registering alias (fixes #10827)
When flattening any command or registering an alias to a node with no direct children (such as a redirect), the code now takes into account any potential redirect/fork/forward on the target node. This fixes the issue where, when registering a command that was simply a redirect, only the namespaced literal would work, and not any aliases of the command.
1 parent bf8405f commit c10d571

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

patches/server/0955-Brigadier-based-command-API.patch

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,10 +686,10 @@ index 0000000000000000000000000000000000000000..1b1642f306771f029e6214a2e2ebebb6
686686
+}
687687
diff --git a/src/main/java/io/papermc/paper/command/brigadier/PaperCommands.java b/src/main/java/io/papermc/paper/command/brigadier/PaperCommands.java
688688
new file mode 100644
689-
index 0000000000000000000000000000000000000000..95d3b42cbe2184b0a04d941f27f7a6e643ef59be
689+
index 0000000000000000000000000000000000000000..27509813a90980be1dfc7bde27d0eba60adfc820
690690
--- /dev/null
691691
+++ b/src/main/java/io/papermc/paper/command/brigadier/PaperCommands.java
692-
@@ -0,0 +1,204 @@
692+
@@ -0,0 +1,205 @@
693693
+package io.papermc.paper.command.brigadier;
694694
+
695695
+import com.google.common.base.Preconditions;
@@ -824,6 +824,7 @@ index 0000000000000000000000000000000000000000..95d3b42cbe2184b0a04d941f27f7a6e6
824824
+ if (redirectTo.getChildren().isEmpty() || hasFlattenRedirectFlag) {
825825
+ redirect = Commands.literal(aliasLiteral)
826826
+ .executes(redirectTo.getCommand())
827+
+ .forward(redirectTo.getRedirect(), redirectTo.getRedirectModifier(), redirectTo.isFork())
827828
+ .requires(redirectTo.getRequirement())
828829
+ .build();
829830
+

0 commit comments

Comments
 (0)