summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2018-01-25 09:10:16 +0100
committerGitHub <noreply@github.com>2018-01-25 09:10:16 +0100
commit95108c134d410040efadfa6bb00c8ce3486fb7fa (patch)
treeb2146da07f96685d3651489de90ab7190a51ff50 /src
parentRemoved cBlockInfo.m_IsSnowable (#4105) (diff)
downloadcuberite-95108c134d410040efadfa6bb00c8ce3486fb7fa.tar
cuberite-95108c134d410040efadfa6bb00c8ce3486fb7fa.tar.gz
cuberite-95108c134d410040efadfa6bb00c8ce3486fb7fa.tar.bz2
cuberite-95108c134d410040efadfa6bb00c8ce3486fb7fa.tar.lz
cuberite-95108c134d410040efadfa6bb00c8ce3486fb7fa.tar.xz
cuberite-95108c134d410040efadfa6bb00c8ce3486fb7fa.tar.zst
cuberite-95108c134d410040efadfa6bb00c8ce3486fb7fa.zip
Diffstat (limited to '')
-rw-r--r--src/ClientHandle.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 3a07de7f1..2d30224ad 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -1431,7 +1431,10 @@ void cClientHandle::HandleRightClick(int a_BlockX, int a_BlockY, int a_BlockZ, e
cPluginManager * PlgMgr = cRoot::Get()->GetPluginManager();
bool Success = false;
- if (IsWithinReach && !m_Player->IsFrozen())
+ if (
+ !PlgMgr->CallHookPlayerRightClick(*m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ) &&
+ IsWithinReach && !m_Player->IsFrozen()
+ )
{
BLOCKTYPE BlockType;
NIBBLETYPE BlockMeta;
@@ -1470,11 +1473,8 @@ void cClientHandle::HandleRightClick(int a_BlockX, int a_BlockY, int a_BlockZ, e
Kick("Too many blocks were placed / interacted with per unit time - hacked client?");
return;
}
- if (!PlgMgr->CallHookPlayerRightClick(*m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ))
- {
- // place a block
- Success = ItemHandler->OnPlayerPlace(*World, *m_Player, HeldItem, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ);
- }
+ // place a block
+ Success = ItemHandler->OnPlayerPlace(*World, *m_Player, HeldItem, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ);
}
else
{
@@ -1752,6 +1752,11 @@ void cClientHandle::HandleUseItem(eHand a_Hand)
LOGD("HandleUseItem: Hand: %d; HeldItem: %s", a_Hand, ItemToFullString(HeldItem).c_str());
+ if (PlgMgr->CallHookPlayerRightClick(*m_Player, -1, 255, -1, BLOCK_FACE_NONE, 0, 0, 0))
+ {
+ return; // Plugin denied click action
+ }
+
// Use item in main / off hand
// TODO: do we need to sync the current inventory with client if it fails?
if (m_Player->IsFrozen() || m_Player->IsGameModeSpectator())