summaryrefslogtreecommitdiffstats
path: root/source/cPlayer.cpp
diff options
context:
space:
mode:
authormtilden@gmail.com <mtilden@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-26 02:07:35 +0100
committermtilden@gmail.com <mtilden@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-26 02:07:35 +0100
commitbf838238e45f4ba96c0653f77cf1bf79e6c13c78 (patch)
tree12a75a20b00d825c45f846f8e11f7ace9144906b /source/cPlayer.cpp
parent- Fixed Bug #99 -> Mobs no longer bother you in creative mode (diff)
downloadcuberite-bf838238e45f4ba96c0653f77cf1bf79e6c13c78.tar
cuberite-bf838238e45f4ba96c0653f77cf1bf79e6c13c78.tar.gz
cuberite-bf838238e45f4ba96c0653f77cf1bf79e6c13c78.tar.bz2
cuberite-bf838238e45f4ba96c0653f77cf1bf79e6c13c78.tar.lz
cuberite-bf838238e45f4ba96c0653f77cf1bf79e6c13c78.tar.xz
cuberite-bf838238e45f4ba96c0653f77cf1bf79e6c13c78.tar.zst
cuberite-bf838238e45f4ba96c0653f77cf1bf79e6c13c78.zip
Diffstat (limited to '')
-rw-r--r--source/cPlayer.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/source/cPlayer.cpp b/source/cPlayer.cpp
index d13e1e5aa..fd7a09a6b 100644
--- a/source/cPlayer.cpp
+++ b/source/cPlayer.cpp
@@ -29,6 +29,7 @@
#include "packets/cPacket_Metadata.h"
#include "packets/cPacket_Chat.h"
#include "packets/cPacket_NewInvalidState.h"
+#include "packets/cPacket_PlayerListItem.h"
#include "Vector3d.h"
#include "Vector3f.h"
@@ -232,6 +233,20 @@ void cPlayer::Tick(float a_Dt)
if(e_EPMetaState == BURNING){
InStateBurning(a_Dt);
}
+
+ // Send Player List
+ cWorld::PlayerList PlayerList = cRoot::Get()->GetWorld()->GetAllPlayers();
+ for( cWorld::PlayerList::iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr )
+ {
+ if ((*itr) && (*itr)->GetClientHandle() && !((*itr)->GetClientHandle()->IsDestroyed())) {
+ cPacket_PlayerListItem PlayerList;
+ PlayerList.m_PlayerName = GetColor() + GetName();
+ PlayerList.m_Online = true;
+ PlayerList.m_Ping = (short)5;
+ (*itr)->GetClientHandle()->Send( PlayerList );
+ }
+ }
+
}
void cPlayer::InStateBurning(float a_Dt) {
@@ -406,10 +421,10 @@ void cPlayer::OpenWindow( cWindow* a_Window )
m_CurrentWindow = a_Window;
}
-void cPlayer::CloseWindow(char wID = -1)
+void cPlayer::CloseWindow(char a_WindowType)
{
if( m_CurrentWindow ) m_CurrentWindow->Close( *this );
- if (wID == 0) {
+ if (a_WindowType == 0) {
if(GetInventory().GetWindow()->GetDraggingItem() && GetInventory().GetWindow()->GetDraggingItem()->m_ItemCount > 0)
{
LOG("Player holds item! Dropping it...");