summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormtilden@gmail.com <mtilden@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-27 17:27:22 +0100
committermtilden@gmail.com <mtilden@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-27 17:27:22 +0100
commit417571424b87a6c8eeb536408f42e5e0fd2ea051 (patch)
treed4378bf2a1a310cf94e0fd4fbce52d591fe588a8 /source
parentAdded VS2010 project and solution for the DeNotch map converter (diff)
downloadcuberite-417571424b87a6c8eeb536408f42e5e0fd2ea051.tar
cuberite-417571424b87a6c8eeb536408f42e5e0fd2ea051.tar.gz
cuberite-417571424b87a6c8eeb536408f42e5e0fd2ea051.tar.bz2
cuberite-417571424b87a6c8eeb536408f42e5e0fd2ea051.tar.lz
cuberite-417571424b87a6c8eeb536408f42e5e0fd2ea051.tar.xz
cuberite-417571424b87a6c8eeb536408f42e5e0fd2ea051.tar.zst
cuberite-417571424b87a6c8eeb536408f42e5e0fd2ea051.zip
Diffstat (limited to 'source')
-rw-r--r--source/cClientHandle.cpp4
-rw-r--r--source/cClientHandle.h2
2 files changed, 4 insertions, 2 deletions
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp
index 724fbd9fc..d99ff04d0 100644
--- a/source/cClientHandle.cpp
+++ b/source/cClientHandle.cpp
@@ -557,7 +557,7 @@ void cClientHandle::HandlePacket( cPacket* a_Packet )
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 > 5) { //kick if more than 3 interactions per .1 seconds
+ if (LastActionCnt > 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!");
@@ -732,7 +732,7 @@ void cClientHandle::HandlePacket( cPacket* a_Packet )
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 > 5) { //kick if more than 3 interactions per .1 seconds
+ if (LastActionCnt > 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;
diff --git a/source/cClientHandle.h b/source/cClientHandle.h
index 7550e5e05..4f8981b78 100644
--- a/source/cClientHandle.h
+++ b/source/cClientHandle.h
@@ -17,6 +17,8 @@ public:
E_PRIORITY_NORMAL
};
+ static const int MAXBLOCKCHANGEINTERACTIONS = 5;
+
cClientHandle(const cSocket & a_Socket);
~cClientHandle();