mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-07 11:10:05 +01:00
Much lower limits for horizontal movement in moving check
This commit is contained in:
parent
8ea62ae52a
commit
2bf722a5f9
@ -3,5 +3,5 @@ name: NoCheatPlugin
|
|||||||
author: Evenprime
|
author: Evenprime
|
||||||
|
|
||||||
main: cc.co.evenprime.bukkit.nocheat.NoCheatPlugin
|
main: cc.co.evenprime.bukkit.nocheat.NoCheatPlugin
|
||||||
version: 0.5.7
|
version: 0.5.8
|
||||||
|
|
||||||
|
@ -24,6 +24,11 @@ public class MovingCheck {
|
|||||||
private static final int MINOR = 1;
|
private static final int MINOR = 1;
|
||||||
private static final int NONE = 0;
|
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
|
// Block types that may be treated specially
|
||||||
private enum BlockType {
|
private enum BlockType {
|
||||||
SOLID, NONSOLID, LADDER, LIQUID, UNKNOWN;
|
SOLID, NONSOLID, LADDER, LIQUID, UNKNOWN;
|
||||||
@ -143,15 +148,16 @@ public class MovingCheck {
|
|||||||
// TODO: Make this check much more precise
|
// TODO: Make this check much more precise
|
||||||
double xDistance = Math.abs(from.getX() - to.getX());
|
double xDistance = Math.abs(from.getX() - to.getX());
|
||||||
double zDistance = Math.abs(from.getZ() - to.getZ());
|
double zDistance = Math.abs(from.getZ() - to.getZ());
|
||||||
|
double combined = xDistance * xDistance + zDistance * zDistance;
|
||||||
// How far are we off?
|
// How far are we off?
|
||||||
if(xDistance > NoCheatConfiguration.movingDistanceHigh || zDistance > NoCheatConfiguration.movingDistanceHigh) {
|
|
||||||
|
if(combined > movingDistanceHigh) {
|
||||||
vl = vl > HEAVY ? vl : HEAVY;
|
vl = vl > HEAVY ? vl : HEAVY;
|
||||||
}
|
}
|
||||||
else if(xDistance > NoCheatConfiguration.movingDistanceMed || zDistance > NoCheatConfiguration.movingDistanceMed) {
|
else if(combined > movingDistanceMed) {
|
||||||
vl = vl > NORMAL ? vl : NORMAL;
|
vl = vl > NORMAL ? vl : NORMAL;
|
||||||
}
|
}
|
||||||
else if(xDistance > NoCheatConfiguration.movingDistanceLow || zDistance > NoCheatConfiguration.movingDistanceLow) {
|
else if(combined > movingDistanceLow) {
|
||||||
vl = vl > MINOR ? vl : MINOR;
|
vl = vl > MINOR ? vl : MINOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,12 +34,7 @@ public class NoCheatConfiguration {
|
|||||||
public static int speedhackMed = 90;
|
public static int speedhackMed = 90;
|
||||||
public static int speedhackHigh = 120;
|
public static int speedhackHigh = 120;
|
||||||
|
|
||||||
// Limits for the moving check
|
public static int movingFreeMoves = 10;
|
||||||
public static double movingDistanceLow = 0.5D;
|
|
||||||
public static double movingDistanceMed = 1.0D;
|
|
||||||
public static double movingDistanceHigh = 5.0D;
|
|
||||||
|
|
||||||
public static int movingFreeMoves = 5;
|
|
||||||
|
|
||||||
// Should moving violations be punished?
|
// Should moving violations be punished?
|
||||||
public static boolean movingLogOnly = false;
|
public static boolean movingLogOnly = false;
|
||||||
@ -103,7 +98,9 @@ public class NoCheatConfiguration {
|
|||||||
speedhackHigh = c.getInt("speedhack.limits.high", 120);
|
speedhackHigh = c.getInt("speedhack.limits.high", 120);
|
||||||
|
|
||||||
movingLogOnly = c.getBoolean("moving.logonly", false);
|
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(" high: 120"); w.newLine();
|
||||||
w.write("moving:"); w.newLine();
|
w.write("moving:"); w.newLine();
|
||||||
w.write(" logonly: false"); w.newLine();
|
w.write(" logonly: false"); w.newLine();
|
||||||
w.write(" freemoves: 5"); w.newLine();
|
w.write(" freemoves: 10"); w.newLine();
|
||||||
w.flush(); w.close();
|
w.flush(); w.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
|
Loading…
Reference in New Issue
Block a user