Small adjustments.

This commit is contained in:
asofold 2012-09-13 00:40:51 +02:00
parent 12fd08be68
commit 136ef9686a
5 changed files with 16 additions and 15 deletions

View File

@ -86,7 +86,7 @@ public class BlockBreakData extends ACheckData {
public int fastBreakBuffer;
public long fastBreakBreakTime = System.currentTimeMillis() - 1000L;
/** Old check sets this to the last interact time, new check sets to first interact time for one block. */
public long fastBreakDamageTime = System.currentTimeMillis();
public long fastBreakfirstDamage = System.currentTimeMillis();
public final ActionFrequency frequencyBuckets;

View File

@ -108,7 +108,7 @@ public class BlockBreakListener implements Listener {
if (cancelled){
event.setCancelled(cancelled);
// Reset damage position:
data.fastBreakDamageTime = now;
data.fastBreakfirstDamage = now;
data.clickedX = block.getX();
data.clickedY = block.getY();
data.clickedZ = block.getZ();
@ -150,7 +150,7 @@ public class BlockBreakListener implements Listener {
* the event
*/
@EventHandler(
ignoreCancelled = false, priority = EventPriority.MONITOR)
ignoreCancelled = false, priority = EventPriority.LOWEST)
public void onPlayerInteract(final PlayerInteractEvent event) {
/*
* ____ _ ___ _ _
@ -168,11 +168,12 @@ public class BlockBreakListener implements Listener {
// (Allows right click to be ignored.)
if (event.getAction() != Action.LEFT_CLICK_BLOCK) return;
final long now = System.currentTimeMillis();
final BlockBreakData data = BlockBreakData.getData(player);
if (event.isCancelled()){
// Reset the time, to avoid certain kinds of cheating.
data.fastBreakDamageTime = System.currentTimeMillis();
data.fastBreakfirstDamage = now;
data.clickedX = Integer.MAX_VALUE; // Should be enough to reset that one.
return;
}
@ -182,12 +183,13 @@ public class BlockBreakListener implements Listener {
if (block == null)
return;
if (data.clickedX == block.getX() && data.clickedZ == block.getZ() && data.clickedY == block.getY()) return;
// if (data.clickedX == block.getX() && data.clickedZ == block.getZ() && data.clickedY == block.getY()) return;
// Only record first damage:
data.fastBreakDamageTime = System.currentTimeMillis();
data.fastBreakfirstDamage = now;
// Also set last clicked blocks position.
data.clickedX = block.getX();
data.clickedY = block.getY();
data.clickedZ = block.getZ();
}
}

View File

@ -53,8 +53,8 @@ public class FastBreak extends Check {
if (player.getGameMode() == GameMode.CREATIVE)
breakingTime = Math.round((double) cc.fastBreakModCreative / 100D * (double) 95);
// fastBreakDamageTime is now first interact on block (!).
final long elapsedTime = now - data.fastBreakDamageTime;
// fastBreakfirstDamage is now first interact on block (!).
final long elapsedTime = now - data.fastBreakfirstDamage;
// Check if the time used time is lower than expected.
if (elapsedTime + cc.fastBreakDelay < breakingTime){

View File

@ -8,7 +8,6 @@ import fr.neatmonster.nocheatplus.actions.ParameterName;
import fr.neatmonster.nocheatplus.checks.Check;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.ViolationData;
import fr.neatmonster.nocheatplus.checks.combined.Improbable;
import fr.neatmonster.nocheatplus.utilities.CheckUtils;
/*
@ -72,11 +71,11 @@ public class Reach extends Check {
// Player passed the check, reward him.
data.reachVL *= 0.9D;
// Check if improbable
if (distance > -0.3){
if (Improbable.check(player, 2.0f, System.currentTimeMillis()))
cancel = true;
}
// // Check if improbable
// if (distance > -0.1){
// if (Improbable.check(player, 1.0f, System.currentTimeMillis()))
// cancel = true;
// }
}
return cancel;

View File

@ -31,7 +31,7 @@ public class WrongBlock extends Check {
data.wrongBlockVL.add(now, 1f);
if (executeActions(player, data.wrongBlockVL.getScore(0.9f), 1D, cc.wrongBlockActions))
cancel = true;
if (Improbable.check(player, 5.0f, now))
if (Improbable.check(player, 2.0f, now))
cancel = true;
}