Skip to content

Commit

Permalink
fix: preserve raw command output messages
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Oct 5, 2024
1 parent 241afde commit 23a6373
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/endstone_core/command/command_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

#include "endstone/detail/command/command_wrapper.h"

#include <bedrock/locale/i18n.h>
#include <boost/algorithm/string.hpp>

#include "bedrock/server/commands/command_origin_loader.h"
Expand Down Expand Up @@ -59,10 +58,10 @@ bool CommandWrapper::execute(CommandSender &sender, const std::vector<std::strin
for (const auto &message : output.getMessages()) {
switch (message.getType()) {
case CommandOutputMessageType::Success:
sender.sendMessage(getI18n().get(message.getMessageId(), message.getParams(), nullptr));
sender.sendMessage(Translatable(message.getMessageId(), message.getParams()));
break;
case CommandOutputMessageType::Error:
sender.sendErrorMessage(getI18n().get(message.getMessageId(), message.getParams(), nullptr));
sender.sendErrorMessage(Translatable(message.getMessageId(), message.getParams()));
break;
default:
throw std::runtime_error("Unsupported CommandOutputMessageType");
Expand Down Expand Up @@ -110,7 +109,7 @@ std::unique_ptr<CommandOrigin> CommandWrapper::getCommandOrigin(CommandSender &s
if (const auto *actor = static_cast<EndstoneActor *>(sender.asActor()); actor) {
CompoundTag tag;
{
tag.putByte("OriginType", static_cast<std::uint8_t>(CommandOriginType::Player));
tag.putByte("OriginType", static_cast<std::uint8_t>(CommandOriginType::Entity));
tag.putInt64("EntityId", actor->getActor().getOrCreateUniqueID().raw_id);
}
return CommandOriginLoader::load(tag, static_cast<ServerLevel &>(actor->getActor().getLevel()));
Expand Down

0 comments on commit 23a6373

Please sign in to comment.