mirror of
https://github.com/cuberite/cuberite.git
synced 2025-01-08 11:57:39 +08:00
ClientHandle: cancel multi-block placements correcty
https://github.com/cuberite/cuberite/pull/5392#issuecomment-1032712796
This commit is contained in:
parent
1fd826aed7
commit
31ab16d52b
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user