mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-12-27 02:48:04 +01:00
Configurable unpunished minor moves for movingCheck
This commit is contained in:
parent
7a976aaf98
commit
66d801b1f8
@ -23,10 +23,7 @@ public class MovingCheck {
|
||||
private static final int NORMAL = 2;
|
||||
private static final int MINOR = 1;
|
||||
private static final int NONE = 0;
|
||||
|
||||
// Every player gets freebee moves to prevent them from getting stuck to easy
|
||||
private static final int freeIllegalMoves = 1;
|
||||
|
||||
|
||||
// Block types that may be treated specially
|
||||
private enum BlockType {
|
||||
SOLID, NONSOLID, LADDER, LIQUID, UNKNOWN;
|
||||
@ -271,7 +268,7 @@ public class MovingCheck {
|
||||
}
|
||||
|
||||
// Start logging only after the freebee illegal moves have all been used
|
||||
if(data.movingMinorViolationsInARow == freeIllegalMoves + 1) {
|
||||
if(data.movingMinorViolationsInARow == NoCheatConfiguration.movingFreeMoves + 1) {
|
||||
NoCheatPlugin.logMinor("NoCheatPlugin: Moving violation: "+event.getPlayer().getName()+" from " + String.format("(%.5f, %.5f, %.5f) to (%.5f, %.5f, %.5f)", event.getFrom().getX(), event.getFrom().getY(), event.getFrom().getZ(), event.getTo().getX(), event.getTo().getY(), event.getTo().getZ()));
|
||||
|
||||
}
|
||||
@ -279,11 +276,11 @@ public class MovingCheck {
|
||||
data.movingMinorViolationsInARow++;
|
||||
|
||||
// 16 minor violations in a row count as one normal violation
|
||||
if(data.movingMinorViolationsInARow % 16 == 0) {
|
||||
if(data.movingMinorViolationsInARow % (NoCheatConfiguration.movingFreeMoves+10) == 0) {
|
||||
normalViolation(data, event);
|
||||
}
|
||||
// Each time the freebee moves are all used up, we may reset the player to his old location
|
||||
else if(data.movingMinorViolationsInARow % (freeIllegalMoves + 1) == 0) {
|
||||
else if(data.movingMinorViolationsInARow % (NoCheatConfiguration.movingFreeMoves + 1) == 0) {
|
||||
resetPlayer(data, event);
|
||||
}
|
||||
}
|
||||
@ -319,7 +316,7 @@ public class MovingCheck {
|
||||
NoCheatPlugin.logNormal("NoCheatPlugin: Moving violation stopped: "+event.getPlayer().getName()+ " total Events: "+ data.movingNormalViolationsInARow);
|
||||
data.movingNormalViolationsInARow = 0;
|
||||
}
|
||||
else if(data.movingMinorViolationsInARow > freeIllegalMoves) {
|
||||
else if(data.movingMinorViolationsInARow > NoCheatConfiguration.movingFreeMoves) {
|
||||
NoCheatPlugin.logMinor("NoCheatPlugin: Moving violation stopped: "+event.getPlayer().getName()+ " total Events: "+ data.movingMinorViolationsInARow);
|
||||
data.movingMinorViolationsInARow = 0;
|
||||
}
|
||||
|
@ -39,6 +39,8 @@ public class NoCheatConfiguration {
|
||||
public static double movingDistanceMed = 1.0D;
|
||||
public static double movingDistanceHigh = 5.0D;
|
||||
|
||||
public static int movingFreeMoves = 2;
|
||||
|
||||
// Should moving violations be punished?
|
||||
public static boolean movingLogOnly = false;
|
||||
|
||||
@ -101,6 +103,7 @@ public class NoCheatConfiguration {
|
||||
speedhackHigh = c.getInt("speedhack.limits.high", 120);
|
||||
|
||||
movingLogOnly = c.getBoolean("moving.logonly", false);
|
||||
movingFreeMoves = c.getInt("moving.freemoves", 2);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -150,6 +153,7 @@ public class NoCheatConfiguration {
|
||||
w.write(" high: 120"); w.newLine();
|
||||
w.write("moving:"); w.newLine();
|
||||
w.write(" logonly: false"); w.newLine();
|
||||
w.write(" freemoves: 2"); w.newLine();
|
||||
w.flush(); w.close();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
|
Loading…
Reference in New Issue
Block a user