From e26aec2cbd04bbf3eb3f9e3beee187d103e811f5 Mon Sep 17 00:00:00 2001 From: asofold Date: Sun, 21 Apr 2013 19:52:55 +0200 Subject: [PATCH] Make login denial configurable for the illegal-move checking. --- .../neatmonster/nocheatplus/checks/moving/MovingConfig.java | 5 +++++ .../nocheatplus/checks/moving/MovingListener.java | 4 ++-- .../java/fr/neatmonster/nocheatplus/config/ConfPaths.java | 3 +++ .../fr/neatmonster/nocheatplus/config/DefaultConfig.java | 3 +++ .../fr/neatmonster/nocheatplus/utilities/CheckUtils.java | 6 +++++- 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingConfig.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingConfig.java index 725370c7..cce1477b 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingConfig.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingConfig.java @@ -124,6 +124,9 @@ public class MovingConfig extends ACheckConfig { public final double noFallyOnGround; public final double yOnGround; public final double yStep; + + // General things. + public final boolean tempKickIllegal; /** * 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); // ystep is set to 0.45 by default, for stairs / steps. yStep = config.getDouble(ConfPaths.MOVING_SURVIVALFLY_YSTEP, 0.001, 0.45, 0.1); + + tempKickIllegal = config.getBoolean(ConfPaths.MOVING_TEMPKICKILLEGAL); } diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java index 6ed3aba4..3c9a2d9c 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java @@ -191,13 +191,13 @@ public class MovingListener extends CheckListener implements TickListener, IRemo } } pLoc.cleanup(); - if (!restored){ + if (!restored && MovingConfig.getConfig(player).tempKickIllegal){ // TODO: correct the location ? NoCheatPlus.denyLogin(player.getName(), 24L * 60L * 60L * 1000L); LogUtil.logSevere("[NCP] could not restore location for " + player.getName() + " deny login for 24 hours"); } // TODO: reset the bounding box of the player ? - CheckUtils.onIllegalMove(player); + CheckUtils.kickIllegalMove(player); } diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/config/ConfPaths.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/config/ConfPaths.java index 22f27a36..e846662e 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/config/ConfPaths.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/config/ConfPaths.java @@ -565,6 +565,9 @@ public abstract class ConfPaths { public static final String MOVING_NOFALL_YONGROUND = MOVING_NOFALL + "yonground"; public static final String MOVING_YONGROUND = MOVING + "yonground"; public static final String MOVING_SURVIVALFLY_YSTEP = MOVING_SURVIVALFLY + "ystep"; + + // General. + public static final String MOVING_TEMPKICKILLEGAL = MOVING + "tempkickillegal"; /* * dP"8 d8 ,e, diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/config/DefaultConfig.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/config/DefaultConfig.java index c7ff1082..d36acaab 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/config/DefaultConfig.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/config/DefaultConfig.java @@ -440,6 +440,9 @@ public class DefaultConfig extends ConfigFile { set(ConfPaths.MOVING_VELOCITY_ACTIVATIONCOUNTER, 80); set(ConfPaths.MOVING_VELOCITY_ACTIVATIONTICKS, 140); + // General. + set(ConfPaths.MOVING_TEMPKICKILLEGAL, true); + /* * dP"8 d8 ,e, * C8b Y d88 888,8, " 888 8e e88 888 dP"Y diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/utilities/CheckUtils.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/utilities/CheckUtils.java index 109756ba..4e0e75d7 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/utilities/CheckUtils.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/utilities/CheckUtils.java @@ -419,7 +419,11 @@ public class CheckUtils { 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."); LogUtil.logWarning("[NCP] Disconnect " + player.getName() + " due to illegal move!"); }