LCEMP v1.1.0 Dedicated Server

This commit is contained in:
NOTPIES
2026-04-20 18:47:13 -04:00
parent f3fc8574c8
commit 797530e883
13 changed files with 1204 additions and 222 deletions

View File

@@ -2,6 +2,7 @@
#include "MeCommand.h"
#include "../../Minecraft.Client/MinecraftServer.h"
#include "../../Minecraft.Client/ConsoleInputSource.h"
#include "../../Minecraft.Client/PlayerConnection.h"
#include "../../Minecraft.Client/PlayerList.h"
#include "../../Minecraft.World/ChatPacket.h"
@@ -12,7 +13,22 @@ void MeCommand::execute(const wstring& args, ConsoleInputSource *src, MinecraftS
src->warn(L"Usage: /me <action ...>");
return;
}
wstring msg = L"* Server " + args;
wstring senderName = L"Server";
if (src != NULL)
{
senderName = src->getConsoleName();
if (senderName.empty())
{
senderName = L"Server";
}
}
wstring msg = L"* " + senderName + L" " + args;
server->getPlayers()->broadcastAll(shared_ptr<Packet>(new ChatPacket(msg)));
src->info(msg);
// player sources already receive the broadcast chat line above
if (dynamic_cast<PlayerConnection *>(src) == NULL)
{
src->info(msg);
}
}