mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-23 16:41:35 +01:00
Merge branch 'command-redirection'
This commit is contained in:
commit
72ad230872
@ -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
|
||||
{
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user