mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-18 18:01:17 +02:00
MorePackets: Make monitored seconds configurable, increase default to 6.
This commit is contained in:
parent
6ba234693a
commit
8ad7009648
@ -13,6 +13,9 @@ import org.bukkit.entity.Player;
|
|||||||
import fr.neatmonster.nocheatplus.checks.access.ACheckData;
|
import fr.neatmonster.nocheatplus.checks.access.ACheckData;
|
||||||
import fr.neatmonster.nocheatplus.checks.access.CheckDataFactory;
|
import fr.neatmonster.nocheatplus.checks.access.CheckDataFactory;
|
||||||
import fr.neatmonster.nocheatplus.checks.access.ICheckData;
|
import fr.neatmonster.nocheatplus.checks.access.ICheckData;
|
||||||
|
import fr.neatmonster.nocheatplus.config.ConfPaths;
|
||||||
|
import fr.neatmonster.nocheatplus.config.ConfigFile;
|
||||||
|
import fr.neatmonster.nocheatplus.config.ConfigManager;
|
||||||
import fr.neatmonster.nocheatplus.utilities.ActionAccumulator;
|
import fr.neatmonster.nocheatplus.utilities.ActionAccumulator;
|
||||||
import fr.neatmonster.nocheatplus.utilities.ActionFrequency;
|
import fr.neatmonster.nocheatplus.utilities.ActionFrequency;
|
||||||
import fr.neatmonster.nocheatplus.utilities.PlayerLocation;
|
import fr.neatmonster.nocheatplus.utilities.PlayerLocation;
|
||||||
@ -61,7 +64,7 @@ public class MovingData extends ACheckData {
|
|||||||
// Note that the trace might be null after just calling this.
|
// Note that the trace might be null after just calling this.
|
||||||
MovingData data = playersMap.get(player.getName());
|
MovingData data = playersMap.get(player.getName());
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
data = new MovingData();
|
data = new MovingData(ConfigManager.getConfigFile(player.getWorld().getName()));
|
||||||
playersMap.put(player.getName(), data);
|
playersMap.put(player.getName(), data);
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
@ -149,9 +152,9 @@ public class MovingData extends ACheckData {
|
|||||||
|
|
||||||
// Data of the more packets check.
|
// Data of the more packets check.
|
||||||
/** Packet frequency count. */
|
/** Packet frequency count. */
|
||||||
public final ActionFrequency morePacketsFreq = new ActionFrequency(10, 500);
|
public final ActionFrequency morePacketsFreq;
|
||||||
/** Burst count. */
|
/** Burst count. */
|
||||||
public final ActionFrequency morePacketsBurstFreq = new ActionFrequency(12, 5000);
|
public final ActionFrequency morePacketsBurstFreq;
|
||||||
private Location morePacketsSetback = null;
|
private Location morePacketsSetback = null;
|
||||||
|
|
||||||
// Data of the more packets vehicle check.
|
// Data of the more packets vehicle check.
|
||||||
@ -208,6 +211,13 @@ public class MovingData extends ACheckData {
|
|||||||
public boolean wasInVehicle = false;
|
public boolean wasInVehicle = false;
|
||||||
public MoveConsistency vehicleConsistency = MoveConsistency.INCONSISTENT;
|
public MoveConsistency vehicleConsistency = MoveConsistency.INCONSISTENT;
|
||||||
|
|
||||||
|
public MovingData(final ConfigFile config) {
|
||||||
|
// TODO: Parameters from cc.
|
||||||
|
final int nob = 2 * Math.max(1, Math.min(60, config.getInt(ConfPaths.MOVING_MOREPACKETS_SECONDS)));
|
||||||
|
morePacketsFreq = new ActionFrequency(nob, 500);
|
||||||
|
morePacketsBurstFreq = new ActionFrequency(12, 5000);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear the data of the fly checks (not more-packets).
|
* Clear the data of the fly checks (not more-packets).
|
||||||
*/
|
*/
|
||||||
|
@ -503,6 +503,7 @@ public abstract class ConfPaths {
|
|||||||
|
|
||||||
private static final String MOVING_MOREPACKETS = MOVING + "morepackets.";
|
private static final String MOVING_MOREPACKETS = MOVING + "morepackets.";
|
||||||
public static final String MOVING_MOREPACKETS_CHECK = MOVING_MOREPACKETS + "active";
|
public static final String MOVING_MOREPACKETS_CHECK = MOVING_MOREPACKETS + "active";
|
||||||
|
public static final String MOVING_MOREPACKETS_SECONDS = MOVING_MOREPACKETS + "seconds";
|
||||||
public static final String MOVING_MOREPACKETS_EPSIDEAL = MOVING_MOREPACKETS + "epsideal";
|
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_EPSMAX = MOVING_MOREPACKETS + "epsmax";
|
||||||
private static final String MOVING_MOREPACKETS_BURST = MOVING_MOREPACKETS + "burst.";
|
private static final String MOVING_MOREPACKETS_BURST = MOVING_MOREPACKETS + "burst.";
|
||||||
|
@ -355,6 +355,7 @@ 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");
|
"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_CHECK, true);
|
||||||
|
set(ConfPaths.MOVING_MOREPACKETS_SECONDS, 6);
|
||||||
set(ConfPaths.MOVING_MOREPACKETS_EPSIDEAL, 20);
|
set(ConfPaths.MOVING_MOREPACKETS_EPSIDEAL, 20);
|
||||||
set(ConfPaths.MOVING_MOREPACKETS_EPSMAX, 22);
|
set(ConfPaths.MOVING_MOREPACKETS_EPSMAX, 22);
|
||||||
set(ConfPaths.MOVING_MOREPACKETS_BURST_PACKETS, 40);
|
set(ConfPaths.MOVING_MOREPACKETS_BURST_PACKETS, 40);
|
||||||
|
Loading…
Reference in New Issue
Block a user