mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/LCEMP-Server.git
synced 2026-05-24 16:14:51 +00:00
Initial commit
This commit is contained in:
33
Commands/KillServerCommand.cpp
Normal file
33
Commands/KillServerCommand.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "stdafx.h"
|
||||
#include "KillServerCommand.h"
|
||||
|
||||
#include "../../Minecraft.Client/MinecraftServer.h"
|
||||
#include "../../Minecraft.Client/ConsoleInputSource.h"
|
||||
#include "../../Minecraft.Client/PlayerList.h"
|
||||
#include "../../Minecraft.Client/ServerPlayer.h"
|
||||
#include "../../Minecraft.World/DamageSource.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
void KillServerCommand::execute(const wstring& args, ConsoleInputSource *src, MinecraftServer *server)
|
||||
{
|
||||
wstringstream ss(args);
|
||||
wstring playerName;
|
||||
|
||||
if (!(ss >> playerName))
|
||||
{
|
||||
src->warn(L"\u00A7cYou must specify which player you wish to perform this action on.");
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerList *players = server->getPlayers();
|
||||
shared_ptr<ServerPlayer> player = players->getPlayer(playerName);
|
||||
if (!player)
|
||||
{
|
||||
src->warn(L"\u00A7cThat player cannot be found");
|
||||
return;
|
||||
}
|
||||
|
||||
player->hurt(DamageSource::outOfWorld, 1000);
|
||||
src->info(L"Ouch. That look like it hurt.");
|
||||
}
|
||||
Reference in New Issue
Block a user