summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2022-02-12 15:22:26 +0100
committerTiger Wang <ziwei.tiger@outlook.com>2022-02-12 15:22:26 +0100
commit31ab16d52b18df9ba2e687bb984356828fe38d0e (patch)
tree97b0e7b68dce47411655b82daa580c2d0fe603df
parentUpdate CONTRIBUTORS (diff)
downloadcuberite-31ab16d52b18df9ba2e687bb984356828fe38d0e.tar
cuberite-31ab16d52b18df9ba2e687bb984356828fe38d0e.tar.gz
cuberite-31ab16d52b18df9ba2e687bb984356828fe38d0e.tar.bz2
cuberite-31ab16d52b18df9ba2e687bb984356828fe38d0e.tar.lz
cuberite-31ab16d52b18df9ba2e687bb984356828fe38d0e.tar.xz
cuberite-31ab16d52b18df9ba2e687bb984356828fe38d0e.tar.zst
cuberite-31ab16d52b18df9ba2e687bb984356828fe38d0e.zip
-rw-r--r--src/ClientHandle.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 0bbb1bea9..24f1b3800 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -1133,12 +1133,12 @@ void cClientHandle::HandleLeftClick(int a_BlockX, int a_BlockY, int a_BlockZ, eB
}
if (
- ((Diff(m_Player->GetPosX(), static_cast<double>(a_BlockX)) > 6) ||
+ (Diff(m_Player->GetPosX(), static_cast<double>(a_BlockX)) > 6) ||
(Diff(m_Player->GetPosY(), static_cast<double>(a_BlockY)) > 6) ||
- (Diff(m_Player->GetPosZ(), static_cast<double>(a_BlockZ)) > 6))
+ (Diff(m_Player->GetPosZ(), static_cast<double>(a_BlockZ)) > 6)
)
{
- m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, *m_Player);
+ m_Player->SendBlocksAround(a_BlockX, a_BlockY, a_BlockZ, 2);
return;
}
}
@@ -1147,7 +1147,7 @@ void cClientHandle::HandleLeftClick(int a_BlockX, int a_BlockY, int a_BlockZ, eB
if (m_Player->IsFrozen() || PlgMgr->CallHookPlayerLeftClick(*m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, static_cast<char>(a_Status)))
{
// A plugin doesn't agree with the action, replace the block on the client and quit:
- m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, *m_Player);
+ m_Player->SendBlocksAround(a_BlockX, a_BlockY, a_BlockZ, 2);
SendPlayerPosition(); // Prevents the player from falling through the block that was temporarily broken client side.
return;
}
@@ -1288,7 +1288,7 @@ void cClientHandle::HandleBlockDigStarted(int a_BlockX, int a_BlockY, int a_Bloc
(Diff(m_Player->GetPosZ(), static_cast<double>(a_BlockZ)) > 6)
)
{
- m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, *m_Player);
+ m_Player->SendBlocksAround(a_BlockX, a_BlockY, a_BlockZ, 2);
return;
}
@@ -1365,8 +1365,7 @@ void cClientHandle::HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_Blo
{
LOGD("Break progress of player %s was less than expected: %f < %f\n", m_Player->GetName().c_str(), m_BreakProgress * 100, FASTBREAK_PERCENTAGE * 100);
// AntiFastBreak doesn't agree with the breaking. Bail out. Send the block back to the client, so that it knows:
- m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, *m_Player);
- m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY + 1, a_BlockZ, *m_Player); // Strange bug with doors
+ m_Player->SendBlocksAround(a_BlockX, a_BlockY, a_BlockZ, 2);
SendPlayerPosition(); // Prevents the player from falling through the block that was temporarily broken client side.
m_Player->SendMessage("FastBreak?"); // TODO Anticheat hook
return;
@@ -1378,8 +1377,7 @@ void cClientHandle::HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_Blo
if (cRoot::Get()->GetPluginManager()->CallHookPlayerBreakingBlock(*m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, DugBlock, DugMeta))
{
// A plugin doesn't agree with the breaking. Bail out. Send the block back to the client, so that it knows:
- m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, *m_Player);
- m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY + 1, a_BlockZ, *m_Player); // Strange bug with doors
+ m_Player->SendBlocksAround(a_BlockX, a_BlockY, a_BlockZ, 2);
SendPlayerPosition(); // Prevents the player from falling through the block that was temporarily broken client side.
return;
}