- Fixed too fast actions kick for real
git-svn-id: http://mc-server.googlecode.com/svn/trunk@149 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
1454d237d1
commit
143b8499e0
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user