summaryrefslogtreecommitdiffstats
path: root/src/Entities/Player.cpp
diff options
context:
space:
mode:
authorHaoTNN <haotnn@gmail.com>2015-05-23 23:06:37 +0200
committerHaoTNN <haotnn@gmail.com>2015-05-23 23:06:37 +0200
commit2578afb2449ac27defb3ac9dcc3d140e980d0d1a (patch)
tree4f8e0f52f39c1eb3189680b0395134d4b72a2228 /src/Entities/Player.cpp
parentMerge remote-tracking branch 'upstream/master' (diff)
parentMerge pull request #2107 from mc-server/cow-waterspawn (diff)
downloadcuberite-2578afb2449ac27defb3ac9dcc3d140e980d0d1a.tar
cuberite-2578afb2449ac27defb3ac9dcc3d140e980d0d1a.tar.gz
cuberite-2578afb2449ac27defb3ac9dcc3d140e980d0d1a.tar.bz2
cuberite-2578afb2449ac27defb3ac9dcc3d140e980d0d1a.tar.lz
cuberite-2578afb2449ac27defb3ac9dcc3d140e980d0d1a.tar.xz
cuberite-2578afb2449ac27defb3ac9dcc3d140e980d0d1a.tar.zst
cuberite-2578afb2449ac27defb3ac9dcc3d140e980d0d1a.zip
Diffstat (limited to 'src/Entities/Player.cpp')
-rw-r--r--src/Entities/Player.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 01ad26297..b5a48d9bf 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -128,6 +128,13 @@ cPlayer::cPlayer(cClientHandlePtr a_Client, const AString & a_PlayerName) :
m_IsFlying = true;
}
}
+
+ if (m_GameMode == gmSpectator) // If player is reconnecting to the server in spectator mode
+ {
+ m_CanFly = true;
+ m_IsFlying = true;
+ m_bVisible = false;
+ }
cRoot::Get()->GetServer()->PlayerCreated(this);
}
@@ -1205,6 +1212,15 @@ void cPlayer::SetGameMode(eGameMode a_GameMode)
SetCanFly(false);
}
+ if (IsGameModeSpectator() && IsVisible())
+ {
+ SetVisible(false);
+ }
+ else if (!IsVisible())
+ {
+ SetVisible(true);
+ }
+
m_World->BroadcastPlayerListUpdateGameMode(*this);
}
@@ -1606,9 +1622,10 @@ bool cPlayer::DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn)
return false;
}
- if (cRoot::Get()->GetPluginManager()->CallHookEntityChangeWorld(*this, *a_World))
+ // Ask the plugins if the player is allowed to changing the world
+ if (cRoot::Get()->GetPluginManager()->CallHookEntityChangingWorld(*this, *a_World))
{
- // A Plugin doesn't allow the player to change the world
+ // A Plugin doesn't allow the player to changing the world
return false;
}