MinecraftConsoles/Minecraft.Server/Console/commands/weather/CliCommandWeather.cpp
Riley M. c0da06e4ee
major: Switch to forward slashes(+more) to fix compilation on Linux (#1403)
Notably also adds some metadata files for NixOS 

* add support for linux clang cross compiles

* add linux clang instructions

* un-capitalize Mob.horse.*

* update the description in flake.nix

---------

Co-authored-by: Loki <lokirautio@gmail.com>
2026-04-14 16:47:37 -05:00

50 lines
1.1 KiB
C++

#include "stdafx.h"
#include "CliCommandWeather.h"
#include "../../ServerCliEngine.h"
#include "../../ServerCliParser.h"
#include "../../../../Minecraft.World/GameCommandPacket.h"
#include "../../../../Minecraft.World/ToggleDownfallCommand.h"
namespace ServerRuntime
{
namespace
{
constexpr const char *kWeatherUsage = "weather";
}
const char *CliCommandWeather::Name() const
{
return "weather";
}
const char *CliCommandWeather::Usage() const
{
return kWeatherUsage;
}
const char *CliCommandWeather::Description() const
{
return "Toggle weather via Minecraft.World command dispatcher.";
}
bool CliCommandWeather::Execute(const ServerCliParsedLine &line, ServerCliEngine *engine)
{
if (line.tokens.size() != 1)
{
engine->LogWarn(std::string("Usage: ") + kWeatherUsage);
return false;
}
std::shared_ptr<GameCommandPacket> packet = ToggleDownfallCommand::preparePacket();
if (packet == nullptr)
{
engine->LogError("Failed to build weather command packet.");
return false;
}
return engine->DispatchWorldCommand(packet->command, packet->data);
}
}