mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-18 18:01:17 +02:00
Add config flag to allow preventing vl reset in chat.text.
This might be temporary, the resetting could get removed completely, or it might be fixed/altered.
This commit is contained in:
parent
4f224eefee
commit
0024e16112
@ -105,7 +105,8 @@ public class ChatConfig extends AsyncCheckConfig {
|
|||||||
public final float textMessageNoLetter;
|
public final float textMessageNoLetter;
|
||||||
public final float textGlobalWeight;
|
public final float textGlobalWeight;
|
||||||
public final float textPlayerWeight;
|
public final float textPlayerWeight;
|
||||||
public boolean textEngineMaximum;
|
public final boolean textEngineMaximum;
|
||||||
|
public final boolean textAllowVLReset;
|
||||||
public final boolean textDebug;
|
public final boolean textDebug;
|
||||||
|
|
||||||
public final boolean chatWarningCheck;
|
public final boolean chatWarningCheck;
|
||||||
@ -194,6 +195,7 @@ public class ChatConfig extends AsyncCheckConfig {
|
|||||||
textEngineMaximum = config.getBoolean(ConfPaths.CHAT_TEXT_ENGINE_MAXIMUM, true);
|
textEngineMaximum = config.getBoolean(ConfPaths.CHAT_TEXT_ENGINE_MAXIMUM, true);
|
||||||
textDebug = config.getBoolean(ConfPaths.CHAT_TEXT_DEBUG, false);
|
textDebug = config.getBoolean(ConfPaths.CHAT_TEXT_DEBUG, false);
|
||||||
textFreqNormActions = config.getOptimizedActionList(ConfPaths.CHAT_TEXT_FREQ_NORM_ACTIONS, Permissions.CHAT_TEXT);
|
textFreqNormActions = config.getOptimizedActionList(ConfPaths.CHAT_TEXT_FREQ_NORM_ACTIONS, Permissions.CHAT_TEXT);
|
||||||
|
textAllowVLReset = config.getBoolean(ConfPaths.CHAT_TEXT_ALLOWVLRESET);
|
||||||
|
|
||||||
chatWarningCheck = config.getBoolean(ConfPaths.CHAT_WARNING_CHECK);
|
chatWarningCheck = config.getBoolean(ConfPaths.CHAT_WARNING_CHECK);
|
||||||
chatWarningLevel = (float) config.getDouble(ConfPaths.CHAT_WARNING_LEVEL);
|
chatWarningLevel = (float) config.getDouble(ConfPaths.CHAT_WARNING_LEVEL);
|
||||||
|
@ -257,8 +257,11 @@ public class Text extends AsyncCheck implements INotifyReload{
|
|||||||
lastCancelledTime = time;
|
lastCancelledTime = time;
|
||||||
|
|
||||||
final double added;
|
final double added;
|
||||||
if (shortTermViolation) added = (shortTermAccumulated - cc.textFreqShortTermLevel)/ 3.0;
|
if (shortTermViolation) {
|
||||||
else added = (accumulated - cc.textFreqNormLevel) / 10.0;
|
added = (shortTermAccumulated - cc.textFreqShortTermLevel)/ 3.0;
|
||||||
|
} else {
|
||||||
|
added = (accumulated - cc.textFreqNormLevel) / 10.0;
|
||||||
|
}
|
||||||
data.textVL += added;
|
data.textVL += added;
|
||||||
|
|
||||||
if (captcha.shouldStartCaptcha(cc, data)) {
|
if (captcha.shouldStartCaptcha(cc, data)) {
|
||||||
@ -267,25 +270,28 @@ public class Text extends AsyncCheck implements INotifyReload{
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if (shortTermViolation) {
|
if (shortTermViolation) {
|
||||||
if (executeActions(player, data.textVL, added, cc.textFreqShortTermActions, isMainThread))
|
if (executeActions(player, data.textVL, added, cc.textFreqShortTermActions, isMainThread)) {
|
||||||
cancel = true;
|
cancel = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (normalViolation) {
|
else if (normalViolation) {
|
||||||
if (executeActions(player, data.textVL, added, cc.textFreqNormActions, isMainThread))
|
if (executeActions(player, data.textVL, added, cc.textFreqNormActions, isMainThread)) {
|
||||||
cancel = true;
|
cancel = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (cc.chatWarningCheck && time - data.chatWarningTime > cc.chatWarningTimeout && (100f * accumulated / cc.textFreqNormLevel > cc.chatWarningLevel || 100f * shortTermAccumulated / cc.textFreqShortTermLevel > cc.chatWarningLevel)) {
|
else if (cc.chatWarningCheck && time - data.chatWarningTime > cc.chatWarningTimeout && (100f * accumulated / cc.textFreqNormLevel > cc.chatWarningLevel || 100f * shortTermAccumulated / cc.textFreqShortTermLevel > cc.chatWarningLevel)) {
|
||||||
NCPAPIProvider.getNoCheatPlusAPI().sendMessageOnTick(player.getName(), ColorUtil.replaceColors(cc.chatWarningMessage));
|
NCPAPIProvider.getNoCheatPlusAPI().sendMessageOnTick(player.getName(), ColorUtil.replaceColors(cc.chatWarningMessage));
|
||||||
data.chatWarningTime = time;
|
data.chatWarningTime = time;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
data.textVL *= 0.95;
|
data.textVL *= 0.95;
|
||||||
if (normalScore < 2.0f * cc.textFreqNormWeight && shortTermScore < 2.0f * cc.textFreqShortTermWeight)
|
if (cc.textAllowVLReset && normalScore < 2.0f * cc.textFreqNormWeight && shortTermScore < 2.0f * cc.textFreqShortTermWeight) {
|
||||||
// Reset the VL.
|
// Reset the VL.
|
||||||
// TODO: maybe elaborate on resetting conditions (after some timeout just divide by two or so?).
|
// TODO: maybe elaborate on resetting conditions (after some timeout just divide by two or so?).
|
||||||
data.textVL = 0.0;
|
data.textVL = 0.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
|
@ -244,6 +244,7 @@ public abstract class ConfPaths {
|
|||||||
public static final String CHAT_TEXT_CHECK = CHAT_TEXT + "active";
|
public static final String CHAT_TEXT_CHECK = CHAT_TEXT + "active";
|
||||||
public static final String CHAT_TEXT_DEBUG = CHAT_TEXT + "debug";
|
public static final String CHAT_TEXT_DEBUG = CHAT_TEXT + "debug";
|
||||||
public static final String CHAT_TEXT_ENGINE_MAXIMUM = CHAT_TEXT + "maximum";
|
public static final String CHAT_TEXT_ENGINE_MAXIMUM = CHAT_TEXT + "maximum";
|
||||||
|
public static final String CHAT_TEXT_ALLOWVLRESET = CHAT_TEXT + "allowvlreset";
|
||||||
public static final String CHAT_TEXT_FREQ = CHAT_TEXT + "frequency.";
|
public static final String CHAT_TEXT_FREQ = CHAT_TEXT + "frequency.";
|
||||||
public static final String CHAT_TEXT_FREQ_NORM = CHAT_TEXT_FREQ + "normal.";
|
public static final String CHAT_TEXT_FREQ_NORM = CHAT_TEXT_FREQ + "normal.";
|
||||||
public static final String CHAT_TEXT_FREQ_NORM_FACTOR = CHAT_TEXT_FREQ_NORM + "factor";
|
public static final String CHAT_TEXT_FREQ_NORM_FACTOR = CHAT_TEXT_FREQ_NORM + "factor";
|
||||||
|
@ -168,6 +168,7 @@ public class DefaultConfig extends ConfigFile {
|
|||||||
|
|
||||||
// Text (ordering on purpose).
|
// Text (ordering on purpose).
|
||||||
set(ConfPaths.CHAT_TEXT_CHECK, true);
|
set(ConfPaths.CHAT_TEXT_CHECK, true);
|
||||||
|
set(ConfPaths.CHAT_TEXT_ALLOWVLRESET, false);
|
||||||
set(ConfPaths.CHAT_TEXT_FREQ_NORM_MIN, 0.0);
|
set(ConfPaths.CHAT_TEXT_FREQ_NORM_MIN, 0.0);
|
||||||
set(ConfPaths.CHAT_TEXT_FREQ_NORM_FACTOR, 0.9D);
|
set(ConfPaths.CHAT_TEXT_FREQ_NORM_FACTOR, 0.9D);
|
||||||
set(ConfPaths.CHAT_TEXT_FREQ_NORM_WEIGHT, 6);
|
set(ConfPaths.CHAT_TEXT_FREQ_NORM_WEIGHT, 6);
|
||||||
|
Loading…
Reference in New Issue
Block a user