// another plugin before we got it)
if(!event.getFrom().getWorld().equals(event.getTo().getWorld()) || event.getFrom().distanceSquared(event.getTo()) > 400) {
return;
}
final NoCheatPlayer player = plugin.getPlayer(event.getPlayer());
final MovingConfig cc = MovingCheck.getConfig(player);
final MovingData data = MovingCheck.getData(player);
// Advance various counters and values that change per movement
// tick. They are needed to decide on how fast a player may
// move.
tickVelocities(data);
// Remember locations
data.from.set(event.getFrom());
final Location to = event.getTo();
data.to.set(to);
PreciseLocation newTo = null;
/** RUNFLY CHECK SECTION **/
// If the player isn't handled by runfly checks
if(!cc.runflyCheck || player.hasPermission(Permissions.MOVING_RUNFLY)) {
// Just because he is allowed now, doesn't mean he will always
// be. So forget data about the player related to moving
data.clearRunFlyData();
} else if(cc.allowFlying || (player.isCreative() && cc.identifyCreativeMode) || player.hasPermission(Permissions.MOVING_FLYING)) {
// Only do the limited flying check
newTo = flyingCheck.check(player, data, cc);
} else {
// Go for the full treatment
newTo = runningCheck.check(player, data, cc);
}
/** MOREPACKETS CHECK SECTION **/
if(!cc.morePacketsCheck || player.hasPermission(Permissions.MOVING_MOREPACKETS)) {
data.clearMorePacketsData();
} else if(newTo == null) {
newTo = morePacketsCheck.check(player, data, cc);
}
// Did one of the check(s) decide we need a new "to"-location?
if(newTo != null) {
// Compose a new location based on coordinates of "newTo" and
// viewing direction of "event.getTo()" to allow the player to
// look somewhere else despite getting pulled back by NoCheat
event.setTo(new Location(player.getPlayer().getWorld(), newTo.x, newTo.y, newTo.z, to.getYaw(), to.getPitch()));
// remember where we send the player to
data.teleportTo.set(newTo);
}
}