diff --git a/src/main/java/com/mojang/brigadier/CommandDispatcher.java b/src/main/java/com/mojang/brigadier/CommandDispatcher.java index e59a43a..22b5699 100644 --- a/src/main/java/com/mojang/brigadier/CommandDispatcher.java +++ b/src/main/java/com/mojang/brigadier/CommandDispatcher.java @@ -109,7 +109,7 @@ public class CommandDispatcher { if (reader.canRead()) { reader.skip(); if (child.getRedirect() != null) { - return parseNodes(child.getRedirect(), reader, context.redirect()); + return parseNodes(child.getRedirect(), reader, context.redirect(child.getRedirect())); } else { return parseNodes(child, reader, context); } diff --git a/src/main/java/com/mojang/brigadier/context/CommandContextBuilder.java b/src/main/java/com/mojang/brigadier/context/CommandContextBuilder.java index 065b5c5..401c93d 100644 --- a/src/main/java/com/mojang/brigadier/context/CommandContextBuilder.java +++ b/src/main/java/com/mojang/brigadier/context/CommandContextBuilder.java @@ -63,8 +63,9 @@ public class CommandContextBuilder { return copy; } - public CommandContextBuilder redirect() { + public CommandContextBuilder redirect(final CommandNode newRoot) { final CommandContextBuilder result = new CommandContextBuilder<>(dispatcher, source); + result.withNode(newRoot, ""); result.parent = build(); return result; }