Much lower limits for horizontal movement in moving check

This commit is contained in:
Evenprime 2011-02-27 15:46:10 +01:00
parent 8ea62ae52a
commit 2bf722a5f9
3 changed files with 17 additions and 14 deletions

View File

@ -3,5 +3,5 @@ name: NoCheatPlugin
author: Evenprime
main: cc.co.evenprime.bukkit.nocheat.NoCheatPlugin
version: 0.5.7
version: 0.5.8

View File

@ -24,6 +24,11 @@ public class MovingCheck {
private static final int MINOR = 1;
private static final int NONE = 0;
// Limits for the moving check
public static double movingDistanceLow = 0.05D;
public static double movingDistanceMed = 0.15D;
public static double movingDistanceHigh = 5.0D;
// Block types that may be treated specially
private enum BlockType {
SOLID, NONSOLID, LADDER, LIQUID, UNKNOWN;
@ -143,15 +148,16 @@ public class MovingCheck {
// TODO: Make this check much more precise
double xDistance = Math.abs(from.getX() - to.getX());
double zDistance = Math.abs(from.getZ() - to.getZ());
double combined = xDistance * xDistance + zDistance * zDistance;
// How far are we off?
if(xDistance > NoCheatConfiguration.movingDistanceHigh || zDistance > NoCheatConfiguration.movingDistanceHigh) {
if(combined > movingDistanceHigh) {
vl = vl > HEAVY ? vl : HEAVY;
}
else if(xDistance > NoCheatConfiguration.movingDistanceMed || zDistance > NoCheatConfiguration.movingDistanceMed) {
else if(combined > movingDistanceMed) {
vl = vl > NORMAL ? vl : NORMAL;
}
else if(xDistance > NoCheatConfiguration.movingDistanceLow || zDistance > NoCheatConfiguration.movingDistanceLow) {
else if(combined > movingDistanceLow) {
vl = vl > MINOR ? vl : MINOR;
}

View File

@ -34,12 +34,7 @@ public class NoCheatConfiguration {
public static int speedhackMed = 90;
public static int speedhackHigh = 120;
// Limits for the moving check
public static double movingDistanceLow = 0.5D;
public static double movingDistanceMed = 1.0D;
public static double movingDistanceHigh = 5.0D;
public static int movingFreeMoves = 5;
public static int movingFreeMoves = 10;
// Should moving violations be punished?
public static boolean movingLogOnly = false;
@ -103,7 +98,9 @@ public class NoCheatConfiguration {
speedhackHigh = c.getInt("speedhack.limits.high", 120);
movingLogOnly = c.getBoolean("moving.logonly", false);
movingFreeMoves = c.getInt("moving.freemoves", 5);
movingFreeMoves = c.getInt("moving.freemoves", 10);
if(movingFreeMoves < 5) movingFreeMoves = 5;
}
/**
@ -153,7 +150,7 @@ public class NoCheatConfiguration {
w.write(" high: 120"); w.newLine();
w.write("moving:"); w.newLine();
w.write(" logonly: false"); w.newLine();
w.write(" freemoves: 5"); w.newLine();
w.write(" freemoves: 10"); w.newLine();
w.flush(); w.close();
} catch (IOException e) {
// TODO Auto-generated catch block