strike counter
This commit is contained in:
@@ -51,6 +51,9 @@ public class ClientConnection extends AbstractConnection {
|
||||
protected SessionID sessionID = null;
|
||||
private byte cryptoInitTries = 0;
|
||||
|
||||
public int strikes = 0;
|
||||
public Long lastStrike = 0L;
|
||||
|
||||
public ClientConnection(ClientConnectionManager connMan,
|
||||
SocketChannel sockChan) {
|
||||
super(connMan, sockChan, true);
|
||||
|
||||
@@ -36,7 +36,7 @@ public enum KeyCloneAudit {
|
||||
|
||||
public static boolean auditNetMsg(ClientNetMsg msg) {
|
||||
boolean valid = true;
|
||||
|
||||
try {
|
||||
if (msg.getProtocolMsg().equals(Protocol.KEEPALIVESERVERCLIENT))
|
||||
return true;
|
||||
|
||||
@@ -64,12 +64,26 @@ public enum KeyCloneAudit {
|
||||
}
|
||||
|
||||
if (origin.fastTargetSwitchCount > 5) {
|
||||
ChatManager.chatSystemInfo(pc, "Possible bot detected: Targeting too quickly.");
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(origin.lastStrike + 2000L < System.currentTimeMillis()) {
|
||||
if (!valid) {
|
||||
origin.strikes++;
|
||||
origin.lastStrike = System.currentTimeMillis();
|
||||
}
|
||||
}else{
|
||||
origin.strikes = 0;
|
||||
}
|
||||
|
||||
if(origin.strikes > 10){
|
||||
//origin.forceDisconnect();
|
||||
ChatManager.chatSystemInfo(pc, "Cheater Cheater Pumpkin Eater");
|
||||
}
|
||||
}catch(Exception e) {
|
||||
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user