1
0
Fork 0

Added check if player is in spectator mode (#4709)

This commit is contained in:
Lukas Pioch 2020-05-04 10:14:59 +02:00 committed by GitHub
parent 8240894d07
commit e3de0aef64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -1641,6 +1641,12 @@ void cClientHandle::HandleSlotSelected(Int16 a_SlotNum)
void cClientHandle::HandleSpectate(const cUUID & a_PlayerUUID)
{
if (!m_Player->IsGameModeSpectator())
{
Kick("Tried to use spectator mode when not in game mode spectator.");
return;
}
m_Player->GetWorld()->DoWithPlayerByUUID(a_PlayerUUID, [=](cPlayer & a_ToSpectate)
{
m_Player->TeleportToEntity(a_ToSpectate);