From ad849d8273d0615a5fda36c306a3aa4eb5557945 Mon Sep 17 00:00:00 2001 From: asofold Date: Fri, 7 Sep 2012 10:53:09 +0200 Subject: [PATCH] Fix nopwnage VL accumulating wrongly. Add nopwnage.debug flag. --- src/fr/neatmonster/nocheatplus/checks/chat/ChatConfig.java | 2 ++ src/fr/neatmonster/nocheatplus/checks/chat/NoPwnage.java | 7 ++++++- src/fr/neatmonster/nocheatplus/config/ConfPaths.java | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/fr/neatmonster/nocheatplus/checks/chat/ChatConfig.java b/src/fr/neatmonster/nocheatplus/checks/chat/ChatConfig.java index d7f1b1dd..3669cd7e 100644 --- a/src/fr/neatmonster/nocheatplus/checks/chat/ChatConfig.java +++ b/src/fr/neatmonster/nocheatplus/checks/chat/ChatConfig.java @@ -82,6 +82,7 @@ public class ChatConfig implements CheckConfig { public final ActionList globalChatActions; public final boolean noPwnageCheck; + public final boolean noPwnageDebug; public final int noPwnageLevel; public final float noPwnageVLFactor; @@ -159,6 +160,7 @@ public class ChatConfig implements CheckConfig { globalChatActions = config.getActionList(ConfPaths.CHAT_GLOBALCHAT_ACTIONS, Permissions.CHAT_GLOBALCHAT); noPwnageCheck = config.getBoolean(ConfPaths.CHAT_NOPWNAGE_CHECK); + noPwnageDebug = config.getBoolean(ConfPaths.CHAT_NOPWNAGE_DEBUG, false); noPwnageLevel = config.getInt(ConfPaths.CHAT_NOPWNAGE_LEVEL); // VL decreasing factor, hidden option. noPwnageVLFactor = (float) config.getDouble(ConfPaths.CHAT_NOPWNAGE_VL_FACTOR, 0.95); diff --git a/src/fr/neatmonster/nocheatplus/checks/chat/NoPwnage.java b/src/fr/neatmonster/nocheatplus/checks/chat/NoPwnage.java index d9147176..cccc3d79 100644 --- a/src/fr/neatmonster/nocheatplus/checks/chat/NoPwnage.java +++ b/src/fr/neatmonster/nocheatplus/checks/chat/NoPwnage.java @@ -208,7 +208,7 @@ public class NoPwnage extends Check implements ICaptcha{ data.noPwnageVL.add(now, (float) (suspicion / 10D)); // 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); } // else @@ -220,6 +220,11 @@ public class NoPwnage extends Check implements ICaptcha{ data.noPwnageLastMessageTime = now; lastGlobalMessage = message; 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; } diff --git a/src/fr/neatmonster/nocheatplus/config/ConfPaths.java b/src/fr/neatmonster/nocheatplus/config/ConfPaths.java index 88f02134..47af8dd4 100644 --- a/src/fr/neatmonster/nocheatplus/config/ConfPaths.java +++ b/src/fr/neatmonster/nocheatplus/config/ConfPaths.java @@ -176,6 +176,7 @@ public abstract class ConfPaths { // 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_DEBUG = CHAT_NOPWNAGE + "debug"; public static final String CHAT_NOPWNAGE_EXCLUSIONS = CHAT_NOPWNAGE + "exclusions"; public static final String CHAT_NOPWNAGE_LEVEL = CHAT_NOPWNAGE + "level"; @@ -382,5 +383,5 @@ public abstract class ConfPaths { * "8",P" */ public static final String STRINGS = "strings"; - + }