mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-02-04 05:41:28 +01:00
Add extra actions for captcha. Add kick to nopwnage actions. [BUG:
Commands don't get executed.]
This commit is contained in:
parent
8b8a92da60
commit
cba9b777f9
@ -85,6 +85,7 @@ public class ChatConfig implements CheckConfig {
|
||||
public final String noPwnageCaptchaQuestion;
|
||||
public final String noPwnageCaptchaSuccess;
|
||||
public final int noPwnageCaptchaTries;
|
||||
public final ActionList noPwnageCaptchaActions;
|
||||
|
||||
public final boolean noPwnageFirstCheck;
|
||||
public final long noPwnageFirstTimeout;
|
||||
@ -151,6 +152,7 @@ public class ChatConfig implements CheckConfig {
|
||||
noPwnageCaptchaQuestion = data.getString(ConfPaths.CHAT_NOPWNAGE_CAPTCHA_QUESTION);
|
||||
noPwnageCaptchaSuccess = data.getString(ConfPaths.CHAT_NOPWNAGE_CAPTCHA_SUCCESS);
|
||||
noPwnageCaptchaTries = data.getInt(ConfPaths.CHAT_NOPWNAGE_CAPTCHA_TRIES);
|
||||
noPwnageCaptchaActions = data.getActionList(ConfPaths.CHAT_NOPWNAGE_CAPTCHA_ACTIONS, Permissions.CHAT_NOPWNAGE_CAPTCHA);
|
||||
|
||||
noPwnageFirstCheck = data.getBoolean(ConfPaths.CHAT_NOPWNAGE_FIRST_CHECK);
|
||||
noPwnageFirstTimeout = data.getLong(ConfPaths.CHAT_NOPWNAGE_FIRST_TIMEOUT);
|
||||
|
@ -169,22 +169,20 @@ public class NoPwnage extends Check {
|
||||
data.noPwnageHasStartedCaptcha = false;
|
||||
player.sendMessage(CheckUtils.replaceColors(cc.noPwnageCaptchaSuccess));
|
||||
} else {
|
||||
// Increment his tries number counter.
|
||||
data.noPwnageCaptchTries++;
|
||||
|
||||
// Does he failed too much times?
|
||||
if (data.noPwnageCaptchTries > cc.noPwnageCaptchaTries) {
|
||||
// Increment the violation level.
|
||||
data.noPwnageVL += cc.noPwnageLevel / 10D;
|
||||
|
||||
// Find out if we need to kick the player or not.
|
||||
cancel = executeActionsThreadSafe(player, data.noPwnageVL, cc.noPwnageLevel / 10D,
|
||||
cc.noPwnageActions, isMainThread);
|
||||
cancel = executeActionsThreadSafe(player, data.noPwnageCaptchTries, 1, cc.noPwnageCaptchaActions,
|
||||
isMainThread);
|
||||
}
|
||||
|
||||
// Increment his tries number counter.
|
||||
data.noPwnageCaptchTries++;
|
||||
|
||||
// Display the question again.
|
||||
player.sendMessage(CheckUtils.replaceColors(cc.noPwnageCaptchaQuestion.replace("[captcha]",
|
||||
data.noPwnageGeneratedCaptcha)));
|
||||
// Display the question again (if not kicked).
|
||||
if (player.isOnline())
|
||||
player.sendMessage(CheckUtils.replaceColors(cc.noPwnageCaptchaQuestion.replace("[captcha]",
|
||||
data.noPwnageGeneratedCaptcha)));
|
||||
}
|
||||
|
||||
// Cancel the message and maybe event.
|
||||
|
@ -157,6 +157,7 @@ public abstract class ConfPaths {
|
||||
public static final String CHAT_NOPWNAGE_CAPTCHA_QUESTION = CHAT_NOPWNAGE_CAPTCHA + "question";
|
||||
public static final String CHAT_NOPWNAGE_CAPTCHA_SUCCESS = CHAT_NOPWNAGE_CAPTCHA + "success";
|
||||
public static final String CHAT_NOPWNAGE_CAPTCHA_TRIES = CHAT_NOPWNAGE_CAPTCHA + "tries";
|
||||
public static final String CHAT_NOPWNAGE_CAPTCHA_ACTIONS = CHAT_NOPWNAGE_CAPTCHA + "actions";
|
||||
|
||||
private static final String CHAT_NOPWNAGE_FIRST = CHAT_NOPWNAGE + "first.";
|
||||
public static final String CHAT_NOPWNAGE_FIRST_CHECK = CHAT_NOPWNAGE_FIRST + "active";
|
||||
|
@ -142,6 +142,7 @@ public class DefaultConfig extends ConfigFile {
|
||||
"&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_TRIES, 3);
|
||||
set(ConfPaths.CHAT_NOPWNAGE_CAPTCHA_ACTIONS, "cancel cmd:kick");
|
||||
|
||||
set(ConfPaths.CHAT_NOPWNAGE_FIRST_CHECK, true);
|
||||
set(ConfPaths.CHAT_NOPWNAGE_FIRST_TIMEOUT, 3000L);
|
||||
@ -182,7 +183,7 @@ public class DefaultConfig extends ConfigFile {
|
||||
set(ConfPaths.CHAT_NOPWNAGE_WARN_PLAYER_MESSAGE,
|
||||
"&cOur system has detected unusual bot activities coming from you. Please be careful with what you say. DON'T repeat what you just said either, unless you want to be banned.");
|
||||
|
||||
set(ConfPaths.CHAT_NOPWNAGE_ACTIONS, "cancel log:nopwnage:2:5:cf cmd:ban cmd:ban-ip");
|
||||
set(ConfPaths.CHAT_NOPWNAGE_ACTIONS, "cancel log:nopwnage:2:5:cf cmd:ban cmd:ban-ip cmd:kick");
|
||||
|
||||
/*
|
||||
* 888'Y88 ,e, 888 d8
|
||||
|
@ -79,6 +79,7 @@ public class Permissions {
|
||||
private static final String CHAT = CHECKS + ".chat";
|
||||
public static final String CHAT_COLOR = CHAT + ".color";
|
||||
public static final String CHAT_NOPWNAGE = CHAT + ".nopwnage";
|
||||
public static final String CHAT_NOPWNAGE_CAPTCHA = CHAT_NOPWNAGE + ".captcha";
|
||||
|
||||
/*
|
||||
* 888'Y88 ,e, 888 d8
|
||||
@ -171,4 +172,5 @@ public class Permissions {
|
||||
public static final String ZOMBE_FLY = ZOMBE + ".fly";
|
||||
public static final String ZOMBE_NOCLIP = ZOMBE + ".noclip";
|
||||
public static final String ZOMBE_CHEAT = ZOMBE + ".cheat";
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user