mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-03-12 06:33:09 +01:00
Optimize the preconditions for morepackets (player).
This commit is contained in:
parent
6625470501
commit
9c925f422b
@ -700,18 +700,19 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Morepackets.
|
// Morepackets.
|
||||||
if (cc.morePacketsCheck && !NCPExemptionManager.isExempted(player, CheckType.MOVING_MOREPACKETS) && !player.hasPermission(Permissions.MOVING_MOREPACKETS)) {
|
if (cc.morePacketsCheck && (newTo == null || data.isMorePacketsSetBackOldest())
|
||||||
// (Always check morepackets, to avoid packet speeding using micro-violations.)
|
&& !NCPExemptionManager.isExempted(player, CheckType.MOVING_MOREPACKETS)
|
||||||
|
&& !player.hasPermission(Permissions.MOVING_MOREPACKETS)) {
|
||||||
|
/* (Always check morepackets, if there is a chance that setting/overriding newTo is appropriate,
|
||||||
|
to avoid packet speeding using micro-violations.) */
|
||||||
final Location mpNewTo = morePackets.check(player, pFrom, pTo, data, cc);
|
final Location mpNewTo = morePackets.check(player, pFrom, pTo, data, cc);
|
||||||
if (mpNewTo != null) {
|
if (mpNewTo != null) {
|
||||||
// Only override set-back, if the morepackets set-back location is older/-est.
|
// Only override set-back, if the morepackets set-back location is older/-est.
|
||||||
if (newTo == null || data.isMorePacketsSetBackOldest()) {
|
|
||||||
if (newTo != null && data.debug) {
|
if (newTo != null && data.debug) {
|
||||||
debug(player, "Override set-back by the older morepackets set-back.");
|
debug(player, "Override set-back by the older morepackets set-back.");
|
||||||
}
|
}
|
||||||
newTo = mpNewTo;
|
newTo = mpNewTo;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Otherwise we need to clear their data.
|
// Otherwise we need to clear their data.
|
||||||
data.clearMorePacketsData();
|
data.clearMorePacketsData();
|
||||||
|
Loading…
Reference in New Issue
Block a user