summaryrefslogtreecommitdiffstats
path: root/source/ClientHandle.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-07-28 19:15:03 +0200
committermadmaxoft <github@xoft.cz>2013-07-28 19:15:03 +0200
commit4746d2251c6204118e710c818d78b89c356a7427 (patch)
tree2573e0b5e70b04aebc35d5da034c8449ff696f3d /source/ClientHandle.cpp
parentProtoProxy now properly waits for both sides to establish encryption (diff)
downloadcuberite-4746d2251c6204118e710c818d78b89c356a7427.tar
cuberite-4746d2251c6204118e710c818d78b89c356a7427.tar.gz
cuberite-4746d2251c6204118e710c818d78b89c356a7427.tar.bz2
cuberite-4746d2251c6204118e710c818d78b89c356a7427.tar.lz
cuberite-4746d2251c6204118e710c818d78b89c356a7427.tar.xz
cuberite-4746d2251c6204118e710c818d78b89c356a7427.tar.zst
cuberite-4746d2251c6204118e710c818d78b89c356a7427.zip
Diffstat (limited to '')
-rw-r--r--source/ClientHandle.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/source/ClientHandle.cpp b/source/ClientHandle.cpp
index 155eac38a..a15facc6e 100644
--- a/source/ClientHandle.cpp
+++ b/source/ClientHandle.cpp
@@ -555,11 +555,8 @@ void cClientHandle::HandleLeftClick(int a_BlockX, int a_BlockY, int a_BlockZ, ch
cItemHandler * ItemHandler = cItemHandler::GetItemHandler(m_Player->GetEquippedItem());
if (ItemHandler->IsFood())
{
- if (PlgMgr->CallHookPlayerEating(*m_Player))
- {
- // A plugin doesn't agree with the action. The plugin itself is responsible for handling the consequences (possible inventory mismatch)
- return;
- }
+ m_Player->AbortEating();
+ return;
}
else
{
@@ -569,7 +566,7 @@ void cClientHandle::HandleLeftClick(int a_BlockX, int a_BlockY, int a_BlockZ, ch
return;
}
}
- LOGINFO("%s: Status SHOOT / EAT not implemented", __FUNCTION__);
+ LOGINFO("%s: Status SHOOT not implemented", __FUNCTION__);
return;
}
@@ -804,15 +801,14 @@ void cClientHandle::HandleRightClick(int a_BlockX, int a_BlockY, int a_BlockZ, c
}
else if (ItemHandler->IsFood())
{
- cItem Item;
- Item.m_ItemType = Equipped.m_ItemType;
- Item.m_ItemCount = 1;
- if (ItemHandler->EatItem(m_Player, &Item))
+ m_Player->StartEating();
+ if (PlgMgr->CallHookPlayerEating(*m_Player))
{
- ItemHandler->OnFoodEaten(World, m_Player, &Item);
- m_Player->GetInventory().RemoveOneEquippedItem();
+ // A plugin won't let us eat, abort (send the proper packets to the client, too):
+ m_Player->AbortEating();
return;
}
+ return;
}
else
{