diff --git a/src/main/java/net/minestom/server/command/builder/CommandDispatcher.java b/src/main/java/net/minestom/server/command/builder/CommandDispatcher.java index a60560d2e..3212c0b5d 100644 --- a/src/main/java/net/minestom/server/command/builder/CommandDispatcher.java +++ b/src/main/java/net/minestom/server/command/builder/CommandDispatcher.java @@ -91,7 +91,7 @@ public class CommandDispatcher { CommandResult commandResult = parse(commandString); ParsedCommand parsedCommand = commandResult.parsedCommand; if (parsedCommand != null) { - commandResult.commandData = parsedCommand.execute(source, commandString); + commandResult.commandData = parsedCommand.execute(source); } return commandResult; } @@ -162,6 +162,7 @@ public class CommandDispatcher { ParsedCommand parsedCommand = new ParsedCommand(); parsedCommand.command = command; + parsedCommand.commandString = commandString; // The default executor should be used if no argument is provided { diff --git a/src/main/java/net/minestom/server/command/builder/ParsedCommand.java b/src/main/java/net/minestom/server/command/builder/ParsedCommand.java index 4a1f09492..cc3059af2 100644 --- a/src/main/java/net/minestom/server/command/builder/ParsedCommand.java +++ b/src/main/java/net/minestom/server/command/builder/ParsedCommand.java @@ -13,6 +13,7 @@ public class ParsedCommand { // Command protected Command command; + protected String commandString; // Command Executor protected CommandSyntax syntax; @@ -30,12 +31,11 @@ public class ParsedCommand { * The command will not be executed if {@link Command#getCondition()} * is not validated. * - * @param source the command source - * @param commandString the command string + * @param source the command source * @return the command data, null if none */ @Nullable - public CommandData execute(@NotNull CommandSender source, @NotNull String commandString) { + public CommandData execute(@NotNull CommandSender source) { // Global listener command.globalListener(source, context, commandString); // Command condition check @@ -78,6 +78,7 @@ public class ParsedCommand { public static ParsedCommand withDefaultExecutor(@NotNull Command command, @NotNull String input) { ParsedCommand parsedCommand = new ParsedCommand(); parsedCommand.command = command; + parsedCommand.commandString = input; parsedCommand.executor = command.getDefaultExecutor(); parsedCommand.context = new CommandContext(input); return parsedCommand;