From 34d6f2ff313b007fe1d7f50d2e813d0d4b6efb90 Mon Sep 17 00:00:00 2001 From: asofold Date: Thu, 15 Nov 2012 11:39:23 +0100 Subject: [PATCH] Add "grace" parameter to the FastBreak config to replace buckets.contention. For compatibility buckets.contention is still read and the maximum of both is used. --- .../nocheatplus/checks/blockbreak/BlockBreakConfig.java | 4 ++-- .../neatmonster/nocheatplus/checks/blockbreak/FastBreak.java | 2 +- src/fr/neatmonster/nocheatplus/config/ConfPaths.java | 1 + src/fr/neatmonster/nocheatplus/config/DefaultConfig.java | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/fr/neatmonster/nocheatplus/checks/blockbreak/BlockBreakConfig.java b/src/fr/neatmonster/nocheatplus/checks/blockbreak/BlockBreakConfig.java index d55f3ab8..4cbd2707 100644 --- a/src/fr/neatmonster/nocheatplus/checks/blockbreak/BlockBreakConfig.java +++ b/src/fr/neatmonster/nocheatplus/checks/blockbreak/BlockBreakConfig.java @@ -79,7 +79,7 @@ public class BlockBreakConfig extends ACheckConfig { public final int fastBreakBuckets; public final long fastBreakBucketDur; public final float fastBreakBucketFactor; - public final long fastBreakBucketContention; + public final long fastBreakGrace; public final long fastBreakDelay; public final int fastBreakModSurvival; public final int fastBreakModCreative; @@ -125,7 +125,7 @@ public class BlockBreakConfig extends ACheckConfig { // Hidden settings of new check. fastBreakDebug = data.getBoolean(ConfPaths.BLOCKBREAK_FASTBREAK_DEBUG, false); fastBreakDelay = data.getLong(ConfPaths.BLOCKBREAK_FASTBREAK_DELAY); - fastBreakBucketContention = data.getLong(ConfPaths.BLOCKBREAK_FASTBREAK_BUCKETS_CONTENTION, 2000); + fastBreakGrace = Math.max(data.getLong(ConfPaths.BLOCKBREAK_FASTBREAK_BUCKETS_CONTENTION, 2000), data.getLong(ConfPaths.BLOCKBREAK_FASTBREAK_GRACE)); fastBreakBucketDur = data.getInt(ConfPaths.BLOCKBREAK_FASTBREAK_BUCKETS_DUR, 4000); fastBreakBucketFactor = (float) data.getDouble(ConfPaths.BLOCKBREAK_FASTBREAK_BUCKETS_FACTOR, 0.99); fastBreakBuckets = data.getInt(ConfPaths.BLOCKBREAK_FASTBREAK_BUCKETS_N, 30); diff --git a/src/fr/neatmonster/nocheatplus/checks/blockbreak/FastBreak.java b/src/fr/neatmonster/nocheatplus/checks/blockbreak/FastBreak.java index 3b3684e1..7dc4dbc3 100644 --- a/src/fr/neatmonster/nocheatplus/checks/blockbreak/FastBreak.java +++ b/src/fr/neatmonster/nocheatplus/checks/blockbreak/FastBreak.java @@ -74,7 +74,7 @@ public class FastBreak extends Check { data.fastBreakPenalties.add(now, (float) missingTime); // Only raise a violation, if the total penalty score exceeds the contention duration (for lag, delay). - if (data.fastBreakPenalties.score(cc.fastBreakBucketFactor) > cc.fastBreakBucketContention){ + if (data.fastBreakPenalties.score(cc.fastBreakBucketFactor) > cc.fastBreakGrace){ // TODO: maybe add one absolute penalty time for big amounts to stop breaking until then final double vlAdded = (double) missingTime / 1000.0; data.fastBreakVL += vlAdded; diff --git a/src/fr/neatmonster/nocheatplus/config/ConfPaths.java b/src/fr/neatmonster/nocheatplus/config/ConfPaths.java index 67844e98..c9e5d900 100644 --- a/src/fr/neatmonster/nocheatplus/config/ConfPaths.java +++ b/src/fr/neatmonster/nocheatplus/config/ConfPaths.java @@ -88,6 +88,7 @@ public abstract class ConfPaths { public static final String BLOCKBREAK_FASTBREAK_BUCKETS_DUR = BLOCKBREAK_FASTBREAK_BUCKETS + "duration"; public static final String BLOCKBREAK_FASTBREAK_BUCKETS_FACTOR = BLOCKBREAK_FASTBREAK_BUCKETS + "factor"; public static final String BLOCKBREAK_FASTBREAK_DELAY = BLOCKBREAK_FASTBREAK + "delay"; + public static final String BLOCKBREAK_FASTBREAK_GRACE = BLOCKBREAK_FASTBREAK + "grace"; public static final String BLOCKBREAK_FASTBREAK_MOD_CREATIVE = BLOCKBREAK_FASTBREAK + "intervalcreative"; public static final String BLOCKBREAK_FASTBREAK_MOD_SURVIVAL = BLOCKBREAK_FASTBREAK + "intervalsurvival"; public static final String BLOCKBREAK_FASTBREAK_ACTIONS = BLOCKBREAK_FASTBREAK + "actions"; diff --git a/src/fr/neatmonster/nocheatplus/config/DefaultConfig.java b/src/fr/neatmonster/nocheatplus/config/DefaultConfig.java index 05691775..c0adf369 100644 --- a/src/fr/neatmonster/nocheatplus/config/DefaultConfig.java +++ b/src/fr/neatmonster/nocheatplus/config/DefaultConfig.java @@ -84,6 +84,7 @@ public class DefaultConfig extends ConfigFile { set(ConfPaths.BLOCKBREAK_FASTBREAK_CHECK, true); set(ConfPaths.BLOCKBREAK_FASTBREAK_DELAY, 90); set(ConfPaths.BLOCKBREAK_FASTBREAK_MOD_SURVIVAL, 100); + set(ConfPaths.BLOCKBREAK_FASTBREAK_GRACE, 2000); set(ConfPaths.BLOCKBREAK_FASTBREAK_ACTIONS, "cancel vl>0 log:fastbreak:3:5:cif cancel"); set(ConfPaths.BLOCKBREAK_FREQUENCY_CHECK, true);