mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-25 16:03:42 +00:00
46 lines
1.3 KiB
C++
46 lines
1.3 KiB
C++
#include "../Build/stdafx.h"
|
|
#include "../Headers/net.minecraft.commands.h"
|
|
#include "../../Minecraft.Client/MinecraftServer.h"
|
|
#include "../../Minecraft.Client/Network/PlayerList.h"
|
|
#include "../../Minecraft.Client/Player/ServerPlayer.h"
|
|
#include "Command.h"
|
|
|
|
AdminLogCommand *Command::logger;
|
|
|
|
bool Command::canExecute(std::shared_ptr<CommandSender> source)
|
|
{
|
|
return source->hasPermission(getId());
|
|
}
|
|
|
|
void Command::logAdminAction(std::shared_ptr<CommandSender> source, ChatPacket::EChatPacketMessage messageType, const std::wstring& message, int customData, const std::wstring& additionalMessage)
|
|
{
|
|
logAdminAction(source, 0, messageType, message, customData, additionalMessage);
|
|
}
|
|
|
|
void Command::logAdminAction(std::shared_ptr<CommandSender> source, int type, ChatPacket::EChatPacketMessage messageType, const std::wstring& message, int customData, const std::wstring& additionalMessage)
|
|
{
|
|
if (logger != NULL)
|
|
{
|
|
logger->logAdminCommand(source, type, messageType, message, customData, additionalMessage);
|
|
}
|
|
}
|
|
|
|
void Command::setLogger(AdminLogCommand *logger)
|
|
{
|
|
Command::logger = logger;
|
|
}
|
|
|
|
std::shared_ptr<ServerPlayer> Command::getPlayer(PlayerUID playerId)
|
|
{
|
|
std::shared_ptr<ServerPlayer> player = MinecraftServer::getInstance()->getPlayers()->getPlayer(playerId);
|
|
|
|
if (player == NULL)
|
|
{
|
|
return nullptr;
|
|
}
|
|
else
|
|
{
|
|
return player;
|
|
}
|
|
}
|