mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-12-27 02:48:04 +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
|
||||
|
||||
main: cc.co.evenprime.bukkit.nocheat.NoCheatPlugin
|
||||
version: 0.5.7
|
||||
version: 0.5.8
|
||||
|
||||
|
@ -23,6 +23,11 @@ public class MovingCheck {
|
||||
private static final int NORMAL = 2;
|
||||
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 {
|
||||
@ -143,18 +148,19 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
// If the target is a bed, allow it
|
||||
if(to.getWorld().getBlockTypeIdAt(to) == Material.BED_BLOCK.getId() && vl <= NORMAL) {
|
||||
return; // players are allowed to "teleport" into a bed over short distances
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user