mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/LCEMP-Server.git
synced 2026-05-25 09:57:06 +00:00
Initial commit
This commit is contained in:
31
Commands/ConsoleCommandDispatcher.cpp
Normal file
31
Commands/ConsoleCommandDispatcher.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "stdafx.h"
|
||||
#include "ConsoleCommandDispatcher.h"
|
||||
#include "../../Minecraft.Client/ConsoleInputSource.h"
|
||||
|
||||
ConsoleCommandDispatcher::~ConsoleCommandDispatcher()
|
||||
{
|
||||
for (AUTO_VAR(it, commandsByName.begin()); it != commandsByName.end(); ++it)
|
||||
delete it->second;
|
||||
commandsByName.clear();
|
||||
}
|
||||
|
||||
void ConsoleCommandDispatcher::addCommand(ServerCommand *command)
|
||||
{
|
||||
commandsByName[command->getName()] = command;
|
||||
}
|
||||
|
||||
bool ConsoleCommandDispatcher::performCommand(const wstring& name, const wstring& args, ConsoleInputSource *src, MinecraftServer *server)
|
||||
{
|
||||
AUTO_VAR(it, commandsByName.find(name));
|
||||
if (it != commandsByName.end())
|
||||
{
|
||||
it->second->execute(args, src, server);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const map<wstring, ServerCommand *>& ConsoleCommandDispatcher::getCommands() const
|
||||
{
|
||||
return commandsByName;
|
||||
}
|
||||
Reference in New Issue
Block a user