Add extra VL and log message for captcha, reset tries after disconnect.

This commit is contained in:
asofold 2012-08-29 07:26:51 +02:00
parent d1124c143f
commit caeccc917c
3 changed files with 10 additions and 3 deletions

View File

@ -47,6 +47,7 @@ public class ChatData implements CheckData {
} }
// Violation levels. // Violation levels.
public double captchaVL;
public double colorVL; public double colorVL;
public double noPwnageVL; public double noPwnageVL;
@ -68,6 +69,8 @@ public class ChatData implements CheckData {
*/ */
public synchronized void clearNoPwnageData() { public synchronized void clearNoPwnageData() {
noPwnageCaptchTries = noPwnageReloginWarnings = 0; noPwnageCaptchTries = noPwnageReloginWarnings = 0;
captchaVL = 0D;
// colorVL, noPwnageVL <- are spared to avoid problems with spam + captcha success.
noPwnageJoinTime = noPwnageLastMessageTime = noPwnageLastMovedTime = noPwnageLastWarningTime = noPwnageLeaveTime = noPwnageReloginWarningTime = 0L; noPwnageJoinTime = noPwnageLastMessageTime = noPwnageLastMovedTime = noPwnageLastWarningTime = noPwnageLeaveTime = noPwnageReloginWarningTime = 0L;
noPwnageGeneratedCaptcha = noPwnageLastMessage = ""; noPwnageGeneratedCaptcha = noPwnageLastMessage = "";
} }

View File

@ -171,12 +171,15 @@ public class NoPwnage extends Check {
} else { } else {
// Increment his tries number counter. // Increment his tries number counter.
data.noPwnageCaptchTries++; data.noPwnageCaptchTries++;
data.captchaVL ++;
// Does he failed too much times? // Does he failed too much times?
if (data.noPwnageCaptchTries > cc.noPwnageCaptchaTries) { if (data.noPwnageCaptchTries > cc.noPwnageCaptchaTries) {
// Find out if we need to kick the player or not. // Find out if we need to kick the player or not.
cancel = executeActionsThreadSafe(player, data.noPwnageCaptchTries, 1, cc.noPwnageCaptchaActions, cancel = executeActionsThreadSafe(player, data.captchaVL, 1, cc.noPwnageCaptchaActions,
isMainThread); isMainThread);
// reset in case of reconnection allowed.
if (!player.isOnline())
data.noPwnageCaptchTries = 0;
} }
// Display the question again (if not kicked). // Display the question again (if not kicked).

View File

@ -141,7 +141,7 @@ public class DefaultConfig extends ConfigFile {
"&cPlease type '&6[captcha]&c' to continue sending messages/commands."); "&cPlease type '&6[captcha]&c' to continue sending messages/commands.");
set(ConfPaths.CHAT_NOPWNAGE_CAPTCHA_SUCCESS, "&aOK, it sounds like you're not a spambot."); set(ConfPaths.CHAT_NOPWNAGE_CAPTCHA_SUCCESS, "&aOK, it sounds like you're not a spambot.");
set(ConfPaths.CHAT_NOPWNAGE_CAPTCHA_TRIES, 3); set(ConfPaths.CHAT_NOPWNAGE_CAPTCHA_TRIES, 3);
set(ConfPaths.CHAT_NOPWNAGE_CAPTCHA_ACTIONS, "cancel cmd:kickcaptcha"); set(ConfPaths.CHAT_NOPWNAGE_CAPTCHA_ACTIONS, "cancel cmd:kickcaptcha VL>4 cancel cmd:kickcaptcha log:captcha:2:5:icf");
set(ConfPaths.CHAT_NOPWNAGE_FIRST_CHECK, true); set(ConfPaths.CHAT_NOPWNAGE_FIRST_CHECK, true);
set(ConfPaths.CHAT_NOPWNAGE_FIRST_TIMEOUT, 3000L); set(ConfPaths.CHAT_NOPWNAGE_FIRST_TIMEOUT, 3000L);
@ -305,6 +305,7 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.STRINGS + ".bpspeed", start + "tried to throw projectiles too quickly" + end); set(ConfPaths.STRINGS + ".bpspeed", start + "tried to throw projectiles too quickly" + end);
set(ConfPaths.STRINGS + ".breach", start set(ConfPaths.STRINGS + ".breach", start
+ "tried to interact with a block over distance [reachdistance] block(s)" + end); + "tried to interact with a block over distance [reachdistance] block(s)" + end);
set(ConfPaths.STRINGS + ".captcha", "[player] failed captcha repeatedly" + end);
set(ConfPaths.STRINGS + ".color", start + "sent colored chat message" + end); set(ConfPaths.STRINGS + ".color", start + "sent colored chat message" + end);
set(ConfPaths.STRINGS + ".critical", start + "tried to do a critical hit but wasn't technically jumping" + end); set(ConfPaths.STRINGS + ".critical", start + "tried to do a critical hit but wasn't technically jumping" + end);
set(ConfPaths.STRINGS + ".drop", start + "tried to drop more items than allowed" + end); set(ConfPaths.STRINGS + ".drop", start + "tried to drop more items than allowed" + end);