mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-24 11:43:36 +00:00
45 lines
1.6 KiB
C++
45 lines
1.6 KiB
C++
#include "../Platform/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;
|
|
|
|
int Command::getPermissionLevel() { return LEVEL_OWNERS; }
|
|
|
|
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;
|
|
}
|
|
} |