summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-02-03 22:12:44 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-02-03 22:12:44 +0100
commitb5e898a608cfa0b872828db842e31ec2d624e598 (patch)
tree2dad88b344187b4d82a215932ae2a81cee1f45db /src
parentFixed multiple invalid permission nodes (diff)
downloadcuberite-b5e898a608cfa0b872828db842e31ec2d624e598.tar
cuberite-b5e898a608cfa0b872828db842e31ec2d624e598.tar.gz
cuberite-b5e898a608cfa0b872828db842e31ec2d624e598.tar.bz2
cuberite-b5e898a608cfa0b872828db842e31ec2d624e598.tar.lz
cuberite-b5e898a608cfa0b872828db842e31ec2d624e598.tar.xz
cuberite-b5e898a608cfa0b872828db842e31ec2d624e598.tar.zst
cuberite-b5e898a608cfa0b872828db842e31ec2d624e598.zip
Diffstat (limited to '')
-rw-r--r--src/ClientHandle.cpp20
-rw-r--r--src/Entities/Player.cpp8
2 files changed, 18 insertions, 10 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 6b61eaae8..b0eb27089 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -227,7 +227,13 @@ void cClientHandle::Authenticate(void)
m_Player->SetIP (m_IPString);
- cRoot::Get()->GetPluginManager()->CallHookPlayerJoined(*m_Player);
+ if (!cRoot::Get()->GetPluginManager()->CallHookPlayerJoined(*m_Player))
+ {
+ AString JoinMessage;
+ AppendPrintf(JoinMessage, "%s[JOIN] %s%s has joined the game", cChatColor::Yellow.c_str(), cChatColor::White.c_str(), m_Username.c_str());
+ cRoot::Get()->BroadcastChat(JoinMessage);
+ LOGINFO("Player %s has joined the game.", m_Username.c_str());
+ }
m_ConfirmPosition = m_Player->GetPosition();
@@ -910,7 +916,7 @@ void cClientHandle::HandleRightClick(int a_BlockX, int a_BlockY, int a_BlockZ, c
cItemHandler * ItemHandler = cItemHandler::GetItemHandler(Equipped.m_ItemType);
- if (ItemHandler->IsPlaceable())
+ if (ItemHandler->IsPlaceable() && (a_BlockFace > -1))
{
HandlePlaceBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, *ItemHandler);
}
@@ -1330,13 +1336,9 @@ void cClientHandle::HandleRespawn(void)
void cClientHandle::HandleDisconnect(const AString & a_Reason)
{
LOGD("Received d/c packet from %s with reason \"%s\"", m_Username.c_str(), a_Reason.c_str());
- if (!cRoot::Get()->GetPluginManager()->CallHookDisconnect(m_Player, a_Reason))
- {
- AString DisconnectMessage;
- Printf(DisconnectMessage, "%s[LEAVE] %s%s has left the game", cChatColor::Yellow.c_str(), cChatColor::White.c_str(), m_Username.c_str());
- cRoot::Get()->BroadcastChat(DisconnectMessage);
- LOGINFO("Player %s has left the game.", m_Username.c_str());
- }
+
+ cRoot::Get()->GetPluginManager()->CallHookDisconnect(m_Player, a_Reason);
+
m_HasSentDC = true;
Destroy();
}
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 8c37fdc8d..a1c942c20 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -130,7 +130,13 @@ cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName)
cPlayer::~cPlayer(void)
{
- cRoot::Get()->GetPluginManager()->CallHookPlayerDestroyed(*this);
+ if (!cRoot::Get()->GetPluginManager()->CallHookPlayerDestroyed(*this))
+ {
+ AString DisconnectMessage;
+ AppendPrintf(DisconnectMessage, "%s[LEAVE] %s%s has left the game", cChatColor::Yellow.c_str(), cChatColor::White.c_str(), GetClientHandle()->GetUsername().c_str());
+ cRoot::Get()->BroadcastChat(DisconnectMessage);
+ LOGINFO("Player %s has left the game.", GetClientHandle()->GetUsername().c_str());
+ }
LOGD("Deleting cPlayer \"%s\" at %p, ID %d", m_PlayerName.c_str(), this, GetUniqueID());