summaryrefslogtreecommitdiffstats
path: root/source/cClientHandle.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-09-07 22:53:37 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-09-07 22:53:37 +0200
commita66f6d905d0c0ade3d4e594e9f855141a2c75952 (patch)
tree7f23719f958481aa805cf4b4970044470407f031 /source/cClientHandle.cpp
parentProtoProxy: fixed a few mis-interpreted packets, added block placement packet parsing. Added leftover dumping for unparsed data (should not happen, if so, parsing is probably wrong) (diff)
downloadcuberite-a66f6d905d0c0ade3d4e594e9f855141a2c75952.tar
cuberite-a66f6d905d0c0ade3d4e594e9f855141a2c75952.tar.gz
cuberite-a66f6d905d0c0ade3d4e594e9f855141a2c75952.tar.bz2
cuberite-a66f6d905d0c0ade3d4e594e9f855141a2c75952.tar.lz
cuberite-a66f6d905d0c0ade3d4e594e9f855141a2c75952.tar.xz
cuberite-a66f6d905d0c0ade3d4e594e9f855141a2c75952.tar.zst
cuberite-a66f6d905d0c0ade3d4e594e9f855141a2c75952.zip
Diffstat (limited to 'source/cClientHandle.cpp')
-rw-r--r--source/cClientHandle.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp
index 1d539ff79..193b6b450 100644
--- a/source/cClientHandle.cpp
+++ b/source/cClientHandle.cpp
@@ -574,6 +574,10 @@ void cClientHandle::HandleBlockDig(int a_BlockX, int a_BlockY, int a_BlockZ, cha
void cClientHandle::HandleBlockPlace(int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, const cItem & a_HeldItem)
{
+ LOGD("HandleBlockPlace: {%d, %d, %d}, face %d, itemtype: %d",
+ a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_HeldItem.m_ItemType
+ );
+
if (!CheckBlockInteractionsRate())
{
return;
@@ -581,8 +585,11 @@ void cClientHandle::HandleBlockPlace(int a_BlockX, int a_BlockY, int a_BlockZ, c
cItem & Equipped = m_Player->GetInventory().GetEquippedItem();
- if ((Equipped.m_ItemType != a_HeldItem.m_ItemType)) // Not valid
+ if ((Equipped.m_ItemType != a_HeldItem.m_ItemType) && (a_HeldItem.m_ItemType != -1))
{
+ // Only compare ItemType, not meta (torches have different metas)
+ // The -1 check is there because sometimes the client sends -1 instead of the held item
+ // ( http://forum.mc-server.org/showthread.php?tid=549&pid=4502#pid4502 )
LOGWARN("Player %s tried to place a block that was not equipped (exp %d, got %d)",
m_Username.c_str(), Equipped.m_ItemType, a_HeldItem.m_ItemType
);
@@ -596,7 +603,7 @@ void cClientHandle::HandleBlockPlace(int a_BlockX, int a_BlockY, int a_BlockZ, c
return;
}
- if (cRoot::Get()->GetPluginManager()->CallHookBlockPlace(m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_HeldItem))
+ if (cRoot::Get()->GetPluginManager()->CallHookBlockPlace(m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, Equipped))
{
if (a_BlockFace > -1)
{