diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MorePackets.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MorePackets.java index 5a143709..68e4cb47 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MorePackets.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MorePackets.java @@ -9,7 +9,6 @@ import fr.neatmonster.nocheatplus.checks.CheckType; import fr.neatmonster.nocheatplus.checks.ViolationData; import fr.neatmonster.nocheatplus.net.NetStatic; import fr.neatmonster.nocheatplus.utilities.PlayerLocation; -import fr.neatmonster.nocheatplus.utilities.TrigUtil; /** * The MorePackets check will try to identify players that send more than the usual @@ -17,13 +16,7 @@ import fr.neatmonster.nocheatplus.utilities.TrigUtil; * checks (flying/running). */ public class MorePackets extends Check { - - /** The maximum number of packets per second that we accept. */ - private final static int maxPackets = 22; - - /** Assumed number of packets per second under ideal conditions. */ - private final static int idealPackets = 20; - + /** * Instantiates a new more packets check. */ @@ -67,7 +60,7 @@ public class MorePackets extends Check { } // Check for a violation of the set limits. - final double violation = NetStatic.morePacketsCheck(data.morePacketsFreq, time, 1f, maxPackets, idealPackets); + final double violation = NetStatic.morePacketsCheck(data.morePacketsFreq, time, 1f, cc.morePacketsEPSMax, cc.morePacketsEPSIdeal); // Process violation result. if (violation > 0.0) { diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingConfig.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingConfig.java index 65b52b4d..5a14fa78 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingConfig.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingConfig.java @@ -76,6 +76,10 @@ public class MovingConfig extends ACheckConfig { public final ActionList creativeFlyActions; public final boolean morePacketsCheck; + /** Assumed number of packets per second under ideal conditions. */ + public final float morePacketsEPSIdeal; + /** The maximum number of packets per second that we accept. */ + public final float morePacketsEPSMax; public final ActionList morePacketsActions; public final boolean morePacketsVehicleCheck; @@ -167,6 +171,8 @@ public class MovingConfig extends ACheckConfig { creativeFlyActions = config.getOptimizedActionList(ConfPaths.MOVING_CREATIVEFLY_ACTIONS, Permissions.MOVING_CREATIVEFLY); morePacketsCheck = config.getBoolean(ConfPaths.MOVING_MOREPACKETS_CHECK); + morePacketsEPSIdeal = config.getInt(ConfPaths.MOVING_MOREPACKETS_EPSIDEAL); + morePacketsEPSMax = Math.max(morePacketsEPSIdeal, config.getInt(ConfPaths.MOVING_MOREPACKETS_EPSMAX)); morePacketsActions = config.getOptimizedActionList(ConfPaths.MOVING_MOREPACKETS_ACTIONS, Permissions.MOVING_MOREPACKETS); morePacketsVehicleCheck = config.getBoolean(ConfPaths.MOVING_MOREPACKETSVEHICLE_CHECK); diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/config/ConfPaths.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/config/ConfPaths.java index 58440013..2a73c05f 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/config/ConfPaths.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/config/ConfPaths.java @@ -503,6 +503,8 @@ public abstract class ConfPaths { private static final String MOVING_MOREPACKETS = MOVING + "morepackets."; public static final String MOVING_MOREPACKETS_CHECK = MOVING_MOREPACKETS + "active"; + public static final String MOVING_MOREPACKETS_EPSIDEAL = MOVING_MOREPACKETS + "epsideal"; + public static final String MOVING_MOREPACKETS_EPSMAX = MOVING_MOREPACKETS + "epsmax"; public static final String MOVING_MOREPACKETS_ACTIONS = MOVING_MOREPACKETS + "actions"; private static final String MOVING_MOREPACKETSVEHICLE = MOVING + "morepacketsvehicle."; diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/config/DefaultConfig.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/config/DefaultConfig.java index f54adfbb..6d165ca1 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/config/DefaultConfig.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/config/DefaultConfig.java @@ -355,6 +355,8 @@ public class DefaultConfig extends ConfigFile { "log:flyshort:3:5:f cancel vl>100 log:flyshort:0:5:if cancel vl>400 log:flylong:0:5:cif cancel"); set(ConfPaths.MOVING_MOREPACKETS_CHECK, true); + set(ConfPaths.MOVING_MOREPACKETS_EPSIDEAL, 20); + set(ConfPaths.MOVING_MOREPACKETS_EPSMAX, 22); set(ConfPaths.MOVING_MOREPACKETS_ACTIONS, "cancel vl>10 log:morepackets:0:2:if cancel vl>100 log:morepackets:0:2:if cancel cmd:kickpackets"); set(ConfPaths.MOVING_MOREPACKETSVEHICLE_CHECK, true);