Skip to content

Commit

Permalink
Copy forward when registering alias (fixes #10827)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ookiegajwa authored and kennytv committed Jul 15, 2024
1 parent aa929d6 commit 53345db
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions patches/server/0975-Brigadier-based-command-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -686,10 +686,10 @@ index 0000000000000000000000000000000000000000..1b1642f306771f029e6214a2e2ebebb6
+}
diff --git a/src/main/java/io/papermc/paper/command/brigadier/PaperCommands.java b/src/main/java/io/papermc/paper/command/brigadier/PaperCommands.java
new file mode 100644
index 0000000000000000000000000000000000000000..a3e128bde0fa4ab0ecab4172f02288a29b9fddc7
index 0000000000000000000000000000000000000000..e7cf64268d6ce4993efc0c372b3797d7338e8985
--- /dev/null
+++ b/src/main/java/io/papermc/paper/command/brigadier/PaperCommands.java
@@ -0,0 +1,194 @@
@@ -0,0 +1,195 @@
+package io.papermc.paper.command.brigadier;
+
+import com.google.common.base.Preconditions;
Expand Down Expand Up @@ -822,6 +822,7 @@ index 0000000000000000000000000000000000000000..a3e128bde0fa4ab0ecab4172f02288a2
+ if (redirectTo.getChildren().isEmpty() || hasFlattenRedirectFlag) {
+ redirect = Commands.literal(aliasLiteral)
+ .executes(redirectTo.getCommand())
+ .forward(redirectTo.getRedirect(), redirectTo.getRedirectModifier(), redirectTo.isFork())
+ .requires(redirectTo.getRequirement())
+ .build();
+
Expand Down

0 comments on commit 53345db

Please sign in to comment.