Re-add combined check, deactivated by default, inclusion of fastbreak

check configurable, deactivated by default.
This commit is contained in:
asofold 2012-09-10 11:07:07 +02:00
parent cd856208d2
commit 310745cde6
6 changed files with 22 additions and 15 deletions

View File

@ -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);

View File

@ -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))

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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";
/*

View File

@ -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