Fix nopwnage VL accumulating wrongly. Add nopwnage.debug flag.

This commit is contained in:
asofold 2012-09-07 10:53:09 +02:00
parent d4103899a5
commit ad849d8273
3 changed files with 10 additions and 2 deletions

View File

@ -82,6 +82,7 @@ public class ChatConfig implements CheckConfig {
public final ActionList globalChatActions; public final ActionList globalChatActions;
public final boolean noPwnageCheck; public final boolean noPwnageCheck;
public final boolean noPwnageDebug;
public final int noPwnageLevel; public final int noPwnageLevel;
public final float noPwnageVLFactor; public final float noPwnageVLFactor;
@ -159,6 +160,7 @@ public class ChatConfig implements CheckConfig {
globalChatActions = config.getActionList(ConfPaths.CHAT_GLOBALCHAT_ACTIONS, Permissions.CHAT_GLOBALCHAT); globalChatActions = config.getActionList(ConfPaths.CHAT_GLOBALCHAT_ACTIONS, Permissions.CHAT_GLOBALCHAT);
noPwnageCheck = config.getBoolean(ConfPaths.CHAT_NOPWNAGE_CHECK); noPwnageCheck = config.getBoolean(ConfPaths.CHAT_NOPWNAGE_CHECK);
noPwnageDebug = config.getBoolean(ConfPaths.CHAT_NOPWNAGE_DEBUG, false);
noPwnageLevel = config.getInt(ConfPaths.CHAT_NOPWNAGE_LEVEL); noPwnageLevel = config.getInt(ConfPaths.CHAT_NOPWNAGE_LEVEL);
// VL decreasing factor, hidden option. // VL decreasing factor, hidden option.
noPwnageVLFactor = (float) config.getDouble(ConfPaths.CHAT_NOPWNAGE_VL_FACTOR, 0.95); noPwnageVLFactor = (float) config.getDouble(ConfPaths.CHAT_NOPWNAGE_VL_FACTOR, 0.95);

View File

@ -208,7 +208,7 @@ public class NoPwnage extends Check implements ICaptcha{
data.noPwnageVL.add(now, (float) (suspicion / 10D)); data.noPwnageVL.add(now, (float) (suspicion / 10D));
// 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, cc.noPwnageVLFactor, suspicion / 10D, cc.noPwnageActions, cancel = executeActionsThreadSafe(player, data.noPwnageVL.getScore(cc.noPwnageVLFactor), suspicion / 10D, cc.noPwnageActions,
isMainThread); isMainThread);
} }
// else // else
@ -220,6 +220,11 @@ public class NoPwnage extends Check implements ICaptcha{
data.noPwnageLastMessageTime = now; data.noPwnageLastMessageTime = now;
lastGlobalMessage = message; lastGlobalMessage = message;
lastGlobalMessageTime = now; lastGlobalMessageTime = now;
if (cc.noPwnageDebug){
final String msg = "[NoCheatPlus][nopwnage] Message ("+player.getName()+"/"+message.length()+"): suspicion="+suspicion +", vl="+CheckUtils.fdec3.format(data.noPwnageVL.getScore(cc.noPwnageVLFactor));
CheckUtils.scheduleOutput(msg);
}
return cancel; return cancel;
} }

View File

@ -176,6 +176,7 @@ public abstract class ConfPaths {
// nopwnage // nopwnage
private static final String CHAT_NOPWNAGE = CHAT + "nopwnage."; private static final String CHAT_NOPWNAGE = CHAT + "nopwnage.";
public static final String CHAT_NOPWNAGE_CHECK = CHAT_NOPWNAGE + "active"; public static final String CHAT_NOPWNAGE_CHECK = CHAT_NOPWNAGE + "active";
public static final String CHAT_NOPWNAGE_DEBUG = CHAT_NOPWNAGE + "debug";
public static final String CHAT_NOPWNAGE_EXCLUSIONS = CHAT_NOPWNAGE + "exclusions"; public static final String CHAT_NOPWNAGE_EXCLUSIONS = CHAT_NOPWNAGE + "exclusions";
public static final String CHAT_NOPWNAGE_LEVEL = CHAT_NOPWNAGE + "level"; public static final String CHAT_NOPWNAGE_LEVEL = CHAT_NOPWNAGE + "level";
@ -382,5 +383,5 @@ public abstract class ConfPaths {
* "8",P" * "8",P"
*/ */
public static final String STRINGS = "strings"; public static final String STRINGS = "strings";
} }