mirror of
https://github.com/DrPerkyLegit/LCEServerTest.git
synced 2026-06-12 07:31:56 +00:00
removed git history
This commit is contained in:
27
Minecraft.Client/StopCommand.h
Normal file
27
Minecraft.Client/StopCommand.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
#include "GenericCommand.h"
|
||||
#include "MinecraftServer.h"
|
||||
#include "Common/Consoles_App.h"
|
||||
#include "Common/App_enums.h"
|
||||
#include "Windows64/Windows64_App.h"
|
||||
#include "PlayerList.h"
|
||||
#include "../Minecraft.Server/Utils/Logger.h"
|
||||
|
||||
class StopCommand : public GenericCommand {
|
||||
public:
|
||||
StopCommand(const wchar_t* _name, const wchar_t* _description) : GenericCommand(_name, _description) {};
|
||||
|
||||
void Execute(CommandSenderType senderType, std::vector<std::wstring>& args, std::shared_ptr<ServerPlayer> player) override {
|
||||
if (senderType == CommandSenderType::PlayerSender) {
|
||||
if (!CommandDispatcher::IsPlayerOperator(player->getOnlineXuid())) {
|
||||
player->sendMessage(CommandDispatcher::NoPermissionMessage);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
MinecraftServer::getInstance()->getPlayerList()->broadcastAll(std::make_shared<ChatPacket>(L"Stopping Server..."));
|
||||
Logger::Info("Stopping Server...");
|
||||
app.SetXuiServerAction(1, eXuiServerAction_SaveGame);
|
||||
app.SetXuiServerAction(1, eXuiServerAction_StopServer);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user