diff options
author | andrew <xdotftw@gmail.com> | 2014-01-20 15:10:39 +0100 |
---|---|---|
committer | andrew <xdotftw@gmail.com> | 2014-01-20 15:10:39 +0100 |
commit | 7728f4bcbee7fa61f005c7b972685deb4bf04f2a (patch) | |
tree | 2aa40e20c9045a997abb25e17d2fa4890bf47e08 /src/Entities/Player.cpp | |
parent | Scoreboard improvements (diff) | |
download | cuberite-7728f4bcbee7fa61f005c7b972685deb4bf04f2a.tar cuberite-7728f4bcbee7fa61f005c7b972685deb4bf04f2a.tar.gz cuberite-7728f4bcbee7fa61f005c7b972685deb4bf04f2a.tar.bz2 cuberite-7728f4bcbee7fa61f005c7b972685deb4bf04f2a.tar.lz cuberite-7728f4bcbee7fa61f005c7b972685deb4bf04f2a.tar.xz cuberite-7728f4bcbee7fa61f005c7b972685deb4bf04f2a.tar.zst cuberite-7728f4bcbee7fa61f005c7b972685deb4bf04f2a.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Player.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index d2fdba909..285aefd25 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -111,6 +111,8 @@ cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName) m_LastJumpHeight = (float)(GetPosY()); m_LastGroundHeight = (float)(GetPosY()); m_Stance = GetPosY() + 1.62; + + // UpdateTeam(); cRoot::Get()->GetServer()->PlayerCreated(this); } @@ -949,8 +951,13 @@ bool cPlayer::IsGameModeAdventure(void) const -void cPlayer::SetTeam(cTeam* a_Team) +void cPlayer::SetTeam(cTeam * a_Team) { + if (m_Team == a_Team) + { + return; + } + if (m_Team) { m_Team->RemovePlayer(GetName()); @@ -968,6 +975,19 @@ void cPlayer::SetTeam(cTeam* a_Team) +cTeam * cPlayer::UpdateTeam(void) +{ + cScoreboard * Scoreboard = m_World->GetScoreBoard(); + + m_Team = Scoreboard->QueryPlayerTeam(GetName()); + + return m_Team; +} + + + + + void cPlayer::OpenWindow(cWindow * a_Window) { if (a_Window != m_CurrentWindow) |