diff --git a/src/fr/neatmonster/nocheatplus/checks/blockbreak/BlockBreakConfig.java b/src/fr/neatmonster/nocheatplus/checks/blockbreak/BlockBreakConfig.java index 4ee1d6e0..d7114767 100644 --- a/src/fr/neatmonster/nocheatplus/checks/blockbreak/BlockBreakConfig.java +++ b/src/fr/neatmonster/nocheatplus/checks/blockbreak/BlockBreakConfig.java @@ -78,6 +78,8 @@ public class BlockBreakConfig extends ACheckConfig { public final int fastBreakBuffer; public final int fastBreakInterval; public final ActionList fastBreakActions; + + public boolean improbableFastBreakCheck; public final boolean noSwingCheck; public final ActionList noSwingActions; @@ -100,6 +102,8 @@ public class BlockBreakConfig extends ACheckConfig { fastBreakInterval = data.getInt(ConfPaths.BLOCKBREAK_FASTBREAK_INTERVAL); fastBreakActions = data.getActionList(ConfPaths.BLOCKBREAK_FASTBREAK_ACTIONS, Permissions.BLOCKBREAK_FASTBREAK); + improbableFastBreakCheck = data.getBoolean(ConfPaths.COMBINED_IMPROBABLE_FASTBREAK_CHECK); + noSwingCheck = data.getBoolean(ConfPaths.BLOCKBREAK_NOSWING_CHECK); noSwingActions = data.getActionList(ConfPaths.BLOCKBREAK_NOSWING_ACTIONS, Permissions.BLOCKBREAK_NOSWING); diff --git a/src/fr/neatmonster/nocheatplus/checks/blockbreak/BlockBreakListener.java b/src/fr/neatmonster/nocheatplus/checks/blockbreak/BlockBreakListener.java index 65ca0e1f..fed40367 100644 --- a/src/fr/neatmonster/nocheatplus/checks/blockbreak/BlockBreakListener.java +++ b/src/fr/neatmonster/nocheatplus/checks/blockbreak/BlockBreakListener.java @@ -9,8 +9,6 @@ import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.player.PlayerAnimationEvent; import org.bukkit.event.player.PlayerInteractEvent; -import fr.neatmonster.nocheatplus.checks.combined.Improbable; - /* * M#"""""""'M dP dP M#"""""""'M dP * ## mmmm. `M 88 88 ## mmmm. `M 88 @@ -74,10 +72,6 @@ public class BlockBreakListener implements Listener { // Has the player broken blocks too quickly? if (fastBreak.isEnabled(player) && fastBreak.check(player, block)) cancelled = true; - - // Combined speed: - if (Improbable.check(player, 1f, System.currentTimeMillis())) - cancelled = true; // Did the arm of the player move before breaking this block? if (!cancelled && noSwing.isEnabled(player) && noSwing.check(player)) diff --git a/src/fr/neatmonster/nocheatplus/checks/blockbreak/FastBreak.java b/src/fr/neatmonster/nocheatplus/checks/blockbreak/FastBreak.java index f2379887..2c6a0b87 100644 --- a/src/fr/neatmonster/nocheatplus/checks/blockbreak/FastBreak.java +++ b/src/fr/neatmonster/nocheatplus/checks/blockbreak/FastBreak.java @@ -7,6 +7,7 @@ import org.bukkit.entity.Player; import fr.neatmonster.nocheatplus.checks.Check; import fr.neatmonster.nocheatplus.checks.CheckType; +import fr.neatmonster.nocheatplus.checks.combined.Improbable; /* * MM""""""""`M dP M#"""""""'M dP @@ -78,10 +79,16 @@ public class FastBreak extends Check { // Reduce the violation level, the player was nice with blocks. data.fastBreakVL *= 0.9D; + } // Remember the block breaking time. data.fastBreakBreakTime = System.currentTimeMillis(); + + // Combined speed: + // TODO: use some value corresponding to allowed block breaking speed ! + if (cc.improbableFastBreakCheck && Improbable.check(player, 1f, System.currentTimeMillis())) + cancel = true; return cancel; } diff --git a/src/fr/neatmonster/nocheatplus/checks/combined/Improbable.java b/src/fr/neatmonster/nocheatplus/checks/combined/Improbable.java index c2ad1510..3b32f43e 100644 --- a/src/fr/neatmonster/nocheatplus/checks/combined/Improbable.java +++ b/src/fr/neatmonster/nocheatplus/checks/combined/Improbable.java @@ -23,10 +23,8 @@ public class Improbable extends Check { * @param now * @return */ - @SuppressWarnings("unused") public static final boolean check(final Player player, final float weight, final long now){ - if (true) return false; // DISABLED FOR THE MOMENT. - else return instance.checkImprobable(player, weight, now); + return instance.checkImprobable(player, weight, now); } diff --git a/src/fr/neatmonster/nocheatplus/config/ConfPaths.java b/src/fr/neatmonster/nocheatplus/config/ConfPaths.java index bffb1ada..25d48e72 100644 --- a/src/fr/neatmonster/nocheatplus/config/ConfPaths.java +++ b/src/fr/neatmonster/nocheatplus/config/ConfPaths.java @@ -257,6 +257,9 @@ public abstract class ConfPaths { public static final String COMBINED_IMPROBABLE_CHECK = COMBINED_IMPROBABLE + "active"; public static final String COMBINED_IMPROBABLE_LEVEL = COMBINED_IMPROBABLE + "level"; + private static final String COMBINED_IMPROBABLE_CHECKS = COMBINED_IMPROBABLE + "checks."; + public static final String COMBINED_IMPROBABLE_FASTBREAK_CHECK = COMBINED_IMPROBABLE_CHECKS + "fastbreak"; + public static final String COMBINED_IMPROBABLE_ACTIONS = COMBINED_IMPROBABLE + "actions"; /* diff --git a/src/fr/neatmonster/nocheatplus/config/DefaultConfig.java b/src/fr/neatmonster/nocheatplus/config/DefaultConfig.java index 04b94a2c..e0508fa0 100644 --- a/src/fr/neatmonster/nocheatplus/config/DefaultConfig.java +++ b/src/fr/neatmonster/nocheatplus/config/DefaultConfig.java @@ -206,12 +206,13 @@ public class DefaultConfig extends ConfigFile { set(ConfPaths.CHAT_NOPWNAGE_ACTIONS, "cancel log:nopwnage:2:5:cf cmd:kicknopwnage"); -// /* -// * Combined ! -// */ -// set(ConfPaths.COMBINED_IMPROBABLE_CHECK , true); -// set(ConfPaths.COMBINED_IMPROBABLE_LEVEL, 300); -// set(ConfPaths.COMBINED_IMPROBABLE_ACTIONS, "cancel log:improbable:2:5:if"); + /* + * Combined ! + */ + set(ConfPaths.COMBINED_IMPROBABLE_CHECK , false); + set(ConfPaths.COMBINED_IMPROBABLE_LEVEL, 300); + set(ConfPaths.COMBINED_IMPROBABLE_FASTBREAK_CHECK, false); + set(ConfPaths.COMBINED_IMPROBABLE_ACTIONS, "cancel log:improbable:2:5:if"); /* * 888'Y88 ,e, 888 d8