From 36e3ae4ae6da3de22ffa16e8171226df51cb005d Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Wed, 17 Jun 2020 20:04:50 +1000 Subject: [PATCH] #675: Fix redirected CommandNodes sometimes not being properly redirected By: Matthias Ngeo --- paper-server/nms-patches/CommandDispatcher.patch | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/paper-server/nms-patches/CommandDispatcher.patch b/paper-server/nms-patches/CommandDispatcher.patch index f199c5b4fb..cc91a04785 100644 --- a/paper-server/nms-patches/CommandDispatcher.patch +++ b/paper-server/nms-patches/CommandDispatcher.patch @@ -140,10 +140,20 @@ argumentbuilder.requires((icompletionprovider) -> { return true; -@@ -222,7 +301,7 @@ - argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect())); +@@ -218,11 +297,15 @@ + } } +- if (argumentbuilder.getRedirect() != null) { +- argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect())); ++ // Craftbukkit start - fix redirected CommandNodes not being properly redirected if it is mapped after commandNode2 ++ CommandNode destination = commandnode2.getRedirect(); ++ if (destination != null) { ++ this.a(destination, (CommandNode) destination.createBuilder().build(), commandlistenerwrapper, map); ++ argumentbuilder.redirect((CommandNode) map.get(destination)); + } ++ // Craftbukkit end + - CommandNode commandnode3 = argumentbuilder.build(); + CommandNode commandnode3 = argumentbuilder.build(); // CraftBukkit - decompile error