Skip to content

Commit

Permalink
feat: improve CommandMap::dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Oct 5, 2024
1 parent 62d59c1 commit b4d9f0d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/endstone_core/command/command_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ bool EndstoneCommandMap::dispatch(CommandSender &sender, std::string command_lin

const auto *target = getCommand(args[0]);
if (!target) {
sender.sendErrorMessage(Translatable("commands.generic.unknown", {args[0]}));
return false;
}

Expand Down
4 changes: 4 additions & 0 deletions src/endstone_core/command/command_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ bool CommandWrapper::execute(CommandSender &sender, const std::vector<std::strin
full_command, *command_origin, CurrentCmdVersion::Latest,
[&sender](auto const &err) { sender.sendErrorMessage(err); });

if (!command) {
return false;
}

// run the command
// TODO: we should pass down the sender as well
CommandOutput output{CommandOutputType::AllOutput};
Expand Down

0 comments on commit b4d9f0d

Please sign in to comment.