Files
MinecraftConsoles/Minecraft.World/CommandDispatcher.cpp
void_17 7074f35e4b shared_ptr -> std::shared_ptr
This is one of the first commits in a plan to remove all `using namespace std;` lines in the entire codebase as it is considered anti-pattern today.
2026-03-02 15:58:20 +07:00

34 lines
758 B
C++

#include "stdafx.h"
#include "net.minecraft.commands.h"
#include "CommandDispatcher.h"
void CommandDispatcher::performCommand(std::shared_ptr<CommandSender> sender, EGameCommand command, byteArray commandData)
{
AUTO_VAR(it, commandsById.find(command));
if(it != commandsById.end())
{
Command *command = it->second;
if (command->canExecute(sender))
{
command->execute(sender, commandData);
}
else
{
#ifndef _CONTENT_PACKAGE
sender->sendMessage(L"\u00A7cYou do not have permission to use this command.");
#endif
}
}
else
{
app.DebugPrintf("Command %d not found!\n", command);
}
}
Command *CommandDispatcher::addCommand(Command *command)
{
commandsById[command->getId()] = command;
commands.insert(command);
return command;
}