summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormtilden@gmail.com <mtilden@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-28 17:09:36 +0100
committermtilden@gmail.com <mtilden@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-28 17:09:36 +0100
commit143b8499e09cba53bfc4b7e73ba0ea75238c24d2 (patch)
treee3f9646d8adaf63d5e654de569f308b08d04f506
parentFixed some small memory leaks (diff)
downloadcuberite-143b8499e09cba53bfc4b7e73ba0ea75238c24d2.tar
cuberite-143b8499e09cba53bfc4b7e73ba0ea75238c24d2.tar.gz
cuberite-143b8499e09cba53bfc4b7e73ba0ea75238c24d2.tar.bz2
cuberite-143b8499e09cba53bfc4b7e73ba0ea75238c24d2.tar.lz
cuberite-143b8499e09cba53bfc4b7e73ba0ea75238c24d2.tar.xz
cuberite-143b8499e09cba53bfc4b7e73ba0ea75238c24d2.tar.zst
cuberite-143b8499e09cba53bfc4b7e73ba0ea75238c24d2.zip
-rw-r--r--source/cClientHandle.cpp10
1 files changed, 5 insertions, 5 deletions
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;