forked from cafeberry/cafeberry
feat: add smartcmd dedicated server
major bug: when connecting to the server a second time, it gets softlocked and keeps repeating ticking connection A\n in debug logs until it times out.
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
#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
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user