mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-07 11:10:05 +01:00
Configurable unpunished minor moves for movingCheck
This commit is contained in:
parent
7a976aaf98
commit
66d801b1f8
@ -24,9 +24,6 @@ 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;
|
||||||
|
|
||||||
// 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
|
// Block types that may be treated specially
|
||||||
private enum BlockType {
|
private enum BlockType {
|
||||||
SOLID, NONSOLID, LADDER, LIQUID, UNKNOWN;
|
SOLID, NONSOLID, LADDER, LIQUID, UNKNOWN;
|
||||||
@ -271,7 +268,7 @@ public class MovingCheck {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Start logging only after the freebee illegal moves have all been used
|
// 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()));
|
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++;
|
data.movingMinorViolationsInARow++;
|
||||||
|
|
||||||
// 16 minor violations in a row count as one normal violation
|
// 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);
|
normalViolation(data, event);
|
||||||
}
|
}
|
||||||
// Each time the freebee moves are all used up, we may reset the player to his old location
|
// 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);
|
resetPlayer(data, event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -319,7 +316,7 @@ public class MovingCheck {
|
|||||||
NoCheatPlugin.logNormal("NoCheatPlugin: Moving violation stopped: "+event.getPlayer().getName()+ " total Events: "+ data.movingNormalViolationsInARow);
|
NoCheatPlugin.logNormal("NoCheatPlugin: Moving violation stopped: "+event.getPlayer().getName()+ " total Events: "+ data.movingNormalViolationsInARow);
|
||||||
data.movingNormalViolationsInARow = 0;
|
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);
|
NoCheatPlugin.logMinor("NoCheatPlugin: Moving violation stopped: "+event.getPlayer().getName()+ " total Events: "+ data.movingMinorViolationsInARow);
|
||||||
data.movingMinorViolationsInARow = 0;
|
data.movingMinorViolationsInARow = 0;
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,8 @@ public class NoCheatConfiguration {
|
|||||||
public static double movingDistanceMed = 1.0D;
|
public static double movingDistanceMed = 1.0D;
|
||||||
public static double movingDistanceHigh = 5.0D;
|
public static double movingDistanceHigh = 5.0D;
|
||||||
|
|
||||||
|
public static int movingFreeMoves = 2;
|
||||||
|
|
||||||
// Should moving violations be punished?
|
// Should moving violations be punished?
|
||||||
public static boolean movingLogOnly = false;
|
public static boolean movingLogOnly = false;
|
||||||
|
|
||||||
@ -101,6 +103,7 @@ 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", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -150,6 +153,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: 2"); 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