Add "strict" flag to blockbreak.fastbreak.

This allows to count break...break instead of interact...break, if set
to false.
This commit is contained in:
asofold 2012-12-28 20:00:05 +01:00
parent a823e6dd1e
commit f9d44cd661
4 changed files with 15 additions and 3 deletions

View File

@ -75,6 +75,7 @@ public class BlockBreakConfig extends ACheckConfig {
public final ActionList directionActions;
public final boolean fastBreakCheck;
public final boolean fastBreakStrict;
public final boolean fastBreakDebug;
public final int fastBreakBuckets;
public final long fastBreakBucketDur;
@ -122,7 +123,7 @@ public class BlockBreakConfig extends ACheckConfig {
// Fastbreak.
fastBreakCheck = data.getBoolean(ConfPaths.BLOCKBREAK_FASTBREAK_CHECK);
// Hidden settings of new check.
fastBreakStrict = data.getBoolean(ConfPaths.BLOCKBREAK_FASTBREAK_STRICT);
fastBreakDebug = data.getBoolean(ConfPaths.BLOCKBREAK_FASTBREAK_DEBUG, false);
fastBreakDelay = data.getLong(ConfPaths.BLOCKBREAK_FASTBREAK_DELAY);
fastBreakGrace = Math.max(data.getLong(ConfPaths.BLOCKBREAK_FASTBREAK_BUCKETS_CONTENTION, 2000), data.getLong(ConfPaths.BLOCKBREAK_FASTBREAK_GRACE));

View File

@ -59,7 +59,16 @@ public class FastBreak extends Check {
else
breakingTime = Math.round((double) cc.fastBreakModSurvival / 100D * (double) BlockProperties.getBreakingDuration(id, player));
// fastBreakfirstDamage is the first interact on block (!).
final long elapsedTime = (data.fastBreakBreakTime > data.fastBreakfirstDamage) ? 0 : now - data.fastBreakfirstDamage;
final long elapsedTime;
// TODO: Should it be breakingTime instead of 0 for inconsistencies?
if (cc.fastBreakStrict){
// Counting interact...break.
elapsedTime = (data.fastBreakBreakTime > data.fastBreakfirstDamage) ? 0 : now - data.fastBreakfirstDamage;
}
else{
// Counting break...break.
elapsedTime = (data.fastBreakBreakTime > now) ? 0 : now - data.fastBreakBreakTime;
}
// Check if the time used time is lower than expected.
// if (isInstaBreak){

View File

@ -79,6 +79,7 @@ public abstract class ConfPaths {
private static final String BLOCKBREAK_FASTBREAK = BLOCKBREAK + "fastbreak.";
public static final String BLOCKBREAK_FASTBREAK_CHECK = BLOCKBREAK_FASTBREAK + "active";
public static final String BLOCKBREAK_FASTBREAK_STRICT = BLOCKBREAK_FASTBREAK + "strict";
public static final String BLOCKBREAK_FASTBREAK_DEBUG = BLOCKBREAK_FASTBREAK + "debug";
private static final String BLOCKBREAK_FASTBREAK_BUCKETS = BLOCKBREAK + "buckets.";
public static final String BLOCKBREAK_FASTBREAK_BUCKETS_CONTENTION = BLOCKBREAK_FASTBREAK_BUCKETS + "contention";

View File

@ -25,7 +25,7 @@ public class DefaultConfig extends ConfigFile {
* NCP build needed for this config.
* (Should only increment with changing or removing paths.)
*/
public static final int buildNumber = 284;
public static final int buildNumber = 299;
/**
* Instantiates a new default configuration.
@ -85,6 +85,7 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.BLOCKBREAK_DIRECTION_ACTIONS, "cancel vl>10 log:bdirection:0:5:if cancel");
set(ConfPaths.BLOCKBREAK_FASTBREAK_CHECK, true);
set(ConfPaths.BLOCKBREAK_FASTBREAK_STRICT, true);
set(ConfPaths.BLOCKBREAK_FASTBREAK_DELAY, 90);
set(ConfPaths.BLOCKBREAK_FASTBREAK_MOD_SURVIVAL, 100);
set(ConfPaths.BLOCKBREAK_FASTBREAK_GRACE, 2000);