forked from mirrors/kolyah35-minecraft-pe-0.6.1
FEAT: Server operators
This commit is contained in:
parent
5194575092
commit
1ec347d5d5
13 changed files with 74 additions and 9 deletions
|
|
@ -6,6 +6,7 @@
|
|||
#include "commands/Command.hpp"
|
||||
#include "commands/CommandHelp.hpp"
|
||||
#include "commands/CommandKick.hpp"
|
||||
#include "commands/CommandOp.hpp"
|
||||
#include "network/packet/ChatPacket.h"
|
||||
#include "network/RakNetInstance.h"
|
||||
#include "world/level/Level.h"
|
||||
|
|
@ -19,6 +20,7 @@ CommandManager::CommandManager() {
|
|||
void CommandManager::registerAllCommands() {
|
||||
m_commands.push_back(new CommandHelp());
|
||||
m_commands.push_back(new CommandKick());
|
||||
m_commands.push_back(new CommandOp());
|
||||
}
|
||||
|
||||
std::vector<std::string> CommandManager::getListAllCommands() {
|
||||
|
|
@ -31,7 +33,7 @@ std::vector<std::string> CommandManager::getListAllCommands() {
|
|||
return ret;
|
||||
}
|
||||
|
||||
void CommandManager::execute(Minecraft& mc, const std::string& input) {
|
||||
void CommandManager::execute(Minecraft& mc, Player& player, const std::string& input) {
|
||||
std::istringstream ss(input);
|
||||
std::string cmd;
|
||||
|
||||
|
|
@ -51,7 +53,7 @@ void CommandManager::execute(Minecraft& mc, const std::string& input) {
|
|||
while (ss >> tok) args.push_back(tok);
|
||||
|
||||
if (!mc.level->isClientSide || (*it)->getFlags() & CommandFlags::COMMAND_FLAG_SINGLEPLAYER_ONLY) {
|
||||
(*it)->execute(mc, args);
|
||||
(*it)->execute(mc, player, args);
|
||||
} else {
|
||||
ChatPacket packet("/" + input);
|
||||
mc.raknetInstance->send(packet);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue