Make login denial configurable for the illegal-move checking.

This commit is contained in:
asofold 2013-04-21 19:52:55 +02:00
parent 2334bc9f22
commit e26aec2cbd
5 changed files with 18 additions and 3 deletions

View File

@ -124,6 +124,9 @@ public class MovingConfig extends ACheckConfig {
public final double noFallyOnGround; public final double noFallyOnGround;
public final double yOnGround; public final double yOnGround;
public final double yStep; public final double yStep;
// General things.
public final boolean tempKickIllegal;
/** /**
* Instantiates a new moving configuration. * Instantiates a new moving configuration.
@ -191,6 +194,8 @@ public class MovingConfig extends ACheckConfig {
noFallyOnGround = config.getDouble(ConfPaths.MOVING_NOFALL_YONGROUND, 0.001, 2.0, yOnGround); noFallyOnGround = config.getDouble(ConfPaths.MOVING_NOFALL_YONGROUND, 0.001, 2.0, yOnGround);
// ystep is set to 0.45 by default, for stairs / steps. // ystep is set to 0.45 by default, for stairs / steps.
yStep = config.getDouble(ConfPaths.MOVING_SURVIVALFLY_YSTEP, 0.001, 0.45, 0.1); yStep = config.getDouble(ConfPaths.MOVING_SURVIVALFLY_YSTEP, 0.001, 0.45, 0.1);
tempKickIllegal = config.getBoolean(ConfPaths.MOVING_TEMPKICKILLEGAL);
} }

View File

@ -191,13 +191,13 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
} }
} }
pLoc.cleanup(); pLoc.cleanup();
if (!restored){ if (!restored && MovingConfig.getConfig(player).tempKickIllegal){
// TODO: correct the location ? // TODO: correct the location ?
NoCheatPlus.denyLogin(player.getName(), 24L * 60L * 60L * 1000L); NoCheatPlus.denyLogin(player.getName(), 24L * 60L * 60L * 1000L);
LogUtil.logSevere("[NCP] could not restore location for " + player.getName() + " deny login for 24 hours"); LogUtil.logSevere("[NCP] could not restore location for " + player.getName() + " deny login for 24 hours");
} }
// TODO: reset the bounding box of the player ? // TODO: reset the bounding box of the player ?
CheckUtils.onIllegalMove(player); CheckUtils.kickIllegalMove(player);
} }

View File

@ -565,6 +565,9 @@ public abstract class ConfPaths {
public static final String MOVING_NOFALL_YONGROUND = MOVING_NOFALL + "yonground"; public static final String MOVING_NOFALL_YONGROUND = MOVING_NOFALL + "yonground";
public static final String MOVING_YONGROUND = MOVING + "yonground"; public static final String MOVING_YONGROUND = MOVING + "yonground";
public static final String MOVING_SURVIVALFLY_YSTEP = MOVING_SURVIVALFLY + "ystep"; public static final String MOVING_SURVIVALFLY_YSTEP = MOVING_SURVIVALFLY + "ystep";
// General.
public static final String MOVING_TEMPKICKILLEGAL = MOVING + "tempkickillegal";
/* /*
* dP"8 d8 ,e, * dP"8 d8 ,e,

View File

@ -440,6 +440,9 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.MOVING_VELOCITY_ACTIVATIONCOUNTER, 80); set(ConfPaths.MOVING_VELOCITY_ACTIVATIONCOUNTER, 80);
set(ConfPaths.MOVING_VELOCITY_ACTIVATIONTICKS, 140); set(ConfPaths.MOVING_VELOCITY_ACTIVATIONTICKS, 140);
// General.
set(ConfPaths.MOVING_TEMPKICKILLEGAL, true);
/* /*
* dP"8 d8 ,e, * dP"8 d8 ,e,
* C8b Y d88 888,8, " 888 8e e88 888 dP"Y * C8b Y d88 888,8, " 888 8e e88 888 dP"Y

View File

@ -419,7 +419,11 @@ public class CheckUtils {
return yawDiff; return yawDiff;
} }
public static void onIllegalMove(final Player player){ /**
* Kick and log.
* @param player
*/
public static void kickIllegalMove(final Player player){
player.kickPlayer("Illegal move."); player.kickPlayer("Illegal move.");
LogUtil.logWarning("[NCP] Disconnect " + player.getName() + " due to illegal move!"); LogUtil.logWarning("[NCP] Disconnect " + player.getName() + " due to illegal move!");
} }