diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp index e27ed4ecb..d65c47e8e 100644 --- a/source/cClientHandle.cpp +++ b/source/cClientHandle.cpp @@ -564,10 +564,10 @@ void cClientHandle::HandlePacket( cPacket* a_Packet ) { int LastActionCnt = m_Player->GetLastBlockActionCnt(); - if ( cRoot::Get()->GetWorld()->GetTime() - m_Player->GetLastBlockActionTime() < 0.1 ) { //only allow block interactions every 0.1 seconds + if ( (cRoot::Get()->GetWorld()->GetTime() - m_Player->GetLastBlockActionTime()) < 0.1 ) { //only allow block interactions every 0.1 seconds m_Player->SetLastBlockActionTime(); //Player tried to interact with a block. Reset last block interation time. m_Player->SetLastBlockActionCnt(LastActionCnt+1); - if (LastActionCnt > MAXBLOCKCHANGEINTERACTIONS) { //kick if more than MAXBLOCKCHANGEINTERACTIONS per .1 seconds + if (m_Player->GetLastBlockActionCnt() > MAXBLOCKCHANGEINTERACTIONS) { //kick if more than MAXBLOCKCHANGEINTERACTIONS per .1 seconds LOGWARN("Player %s tried to interact with a block too quickly! (could indicate bot) Was Kicked.", GetUsername() ); //TODO Too many false-positives :s for example on a minimal server lagg :s should be re checked Kick("You're a baaaaaad boy!"); @@ -739,10 +739,10 @@ void cClientHandle::HandlePacket( cPacket* a_Packet ) { int LastActionCnt = m_Player->GetLastBlockActionCnt(); - if ( cRoot::Get()->GetWorld()->GetTime() - m_Player->GetLastBlockActionTime() < 0.1 ) { //only allow block interactions every 0.1 seconds + if ( (cRoot::Get()->GetWorld()->GetTime() - m_Player->GetLastBlockActionTime()) < 0.1 ) { //only allow block interactions every 0.1 seconds m_Player->SetLastBlockActionTime(); //Player tried to interact with a block. Reset last block interation time. m_Player->SetLastBlockActionCnt(LastActionCnt+1); - if (LastActionCnt > MAXBLOCKCHANGEINTERACTIONS) { //kick if more than MAXBLOCKCHANGEINTERACTIONS per .1 seconds + if (m_Player->GetLastBlockActionCnt() > MAXBLOCKCHANGEINTERACTIONS) { //kick if more than MAXBLOCKCHANGEINTERACTIONS per .1 seconds LOGWARN("Player %s tried to interact with a block too quickly! (could indicate bot) Was Kicked.", GetUsername() ); Kick("You're a baaaaaad boy!"); break; @@ -1235,7 +1235,7 @@ void cClientHandle::HandlePacket( cPacket* a_Packet ) if (PacketData->m_KeepAliveID == m_PingID) { cTimer t1; - m_Ping = (short)(t1.GetNowTime() - m_PingStartTime); + m_Ping = (short)((t1.GetNowTime() - m_PingStartTime) / 2); } } break;