Examples of PlayerLocation


Examples of fr.neatmonster.nocheatplus.utilities.PlayerLocation

            data.timeSprinting = 0;
        }

        // Prepare locations for use.
        // TODO: Block flags might not be needed if neither sf nor passable get checked.
        final PlayerLocation pFrom, pTo;
        pFrom = moveInfo.from;
        pTo = moveInfo.to;

        // HOT FIX - for VehicleLeaveEvent missing.
        if (data.wasInVehicle) {
            onVehicleLeaveMiss(player, data, cc);
        }

        // Potion effect "Jump".
        final double jumpAmplifier = survivalFly.getJumpAmplifier(player);
        if (jumpAmplifier > data.jumpAmplifier) {
            data.jumpAmplifier = jumpAmplifier;
        }
        // TODO: same for speed (once medium is introduced).

        // Velocity tick (decrease + invalidation).
        // TODO: Rework to generic (?) queued velocity entries: activation + invalidation
        final int tick = TickTask.getTick();
        data.removeInvalidVelocity(tick - cc.velocityActivationTicks);
        data.velocityTick();

        // Check passable first to prevent set-back override.
        // TODO: Redesign to set set-backs later (queue + invalidate).
        boolean mightSkipNoFall = false; // If to skip nofall check (mainly on violation of other checks).
        if (newTo == null && cc.passableCheck && !NCPExemptionManager.isExempted(player, CheckType.MOVING_PASSABLE) && !player.hasPermission(Permissions.MOVING_PASSABLE)) {
            // Passable is checked first to get the original set-back locations from the other checks, if needed.
            newTo = passable.check(player, loc, pFrom, pTo, data, cc);
            if (newTo != null) {
                // Check if to skip the nofall check.
                mightSkipNoFall = true;
            }
        }

        // Check which fly check to use.
        final boolean checkCf;
        final boolean checkSf;
        if (shouldCheckSurvivalFly(player, data, cc)) {
            checkCf = false;
            checkSf = true;
            data.adjustWalkSpeed(player.getWalkSpeed(), tick, cc.speedGrace);

        }
        else if (cc.creativeFlyCheck && !NCPExemptionManager.isExempted(player, CheckType.MOVING_CREATIVEFLY) && !player.hasPermission(Permissions.MOVING_CREATIVEFLY)) {
            checkCf = true;
            checkSf = false;
            data.adjustFlySpeed(player.getFlySpeed(), tick, cc.speedGrace);
            data.adjustWalkSpeed(player.getWalkSpeed(), tick, cc.speedGrace);
        }
        else{
            checkCf = checkSf = false;
        }

        // Flying checks.
        if (checkSf) {
            // SurvivalFly

            // Collect block flags.
            // TODO: Could further differentiate if really needed to (newTo / NoFall).
            final double maxYNoFall = Math.max(cc.noFallyOnGround, cc.yOnGround);
            pFrom.collectBlockFlags(maxYNoFall);
            if (pFrom.isSamePos(pTo)) {
                // TODO: Could consider pTo = pFrom, set pitch / yaw elsewhere.
                // Sets all properties, but only once.
                pTo.prepare(pFrom);
            }
            else{
                // Might collect block flags for small distances with the containing bounds for both.
                pTo.collectBlockFlags(maxYNoFall);
            }

            // Actual check.
            if (newTo == null) {
                // Only check if passable has not already set back.
                newTo = survivalFly.check(player, pFrom, pTo, data, cc, time);
            }
            final boolean checkNf = cc.noFallCheck && !NCPExemptionManager.isExempted(player, CheckType.MOVING_NOFALL) && !player.hasPermission(Permissions.MOVING_NOFALL);
            if (newTo == null) {
                // Hover.
                // TODO: Could reset for from-on-ground as well, for not too big moves.
                if (cc.sfHoverCheck && !data.toWasReset && !pTo.isOnGround()) {
                    // Start counting ticks.
                    hoverTicks.add(playerName);
                    data.sfHoverTicks = 0;
                }
                else{
                    data.sfHoverTicks = -1;
                }
                // NoFall.
                if (checkNf) {
                    noFall.check(player, loc, pFrom, pTo, data, cc);
                }
            }
            else{
                if (checkNf && cc.sfFallDamage) {
                    if (mightSkipNoFall) {
                        // Check if to really skip.
                        if (!pFrom.isOnGround() && !pFrom.isResetCond()) {
                            mightSkipNoFall = false;
                        }
                    }
                    if (!mightSkipNoFall) {
                        noFall.checkDamage(player, data, Math.min(Math.min(from.getY(), to.getY()), loc.getY()));
                    }
                }
            }
        }
        else if (checkCf) {
            // CreativeFly
            if (newTo == null) {
                newTo = creativeFly.check(player, pFrom, pTo, data, cc, time);
            }
            data.sfHoverTicks = -1;
            data.sfLowJump = false;
        }
        else{
            // No fly checking :(.
            data.clearFlyData();
        }

        // Morepackets.
        // TODO: Also update counters if newTo == null?
        if (newTo == null && cc.morePacketsCheck && !NCPExemptionManager.isExempted(player, CheckType.MOVING_MOREPACKETS) && !player.hasPermission(Permissions.MOVING_MOREPACKETS)) {
            // If it hasn't been stopped by any other check and is handled by the more packets check, execute it.
            newTo = morePackets.check(player, pFrom, pTo, data, cc);
        } else {
            // Otherwise we need to clear their data.
            data.clearMorePacketsData();
        }

        // Reset jump amplifier if needed.
        if ((checkSf || checkCf) && jumpAmplifier != data.jumpAmplifier) {
            if (data.noFallAssumeGround || pFrom.isOnGround() || pTo.isOnGround()) {
                data.jumpAmplifier = jumpAmplifier;
            }
        }

View Full Code Here

Examples of fr.neatmonster.nocheatplus.utilities.PlayerLocation

            else {
                moveInfo = parkedInfo.remove(parkedInfo.size() - 1);
            }
            moveInfo.set(player, loc, null, cc.noFallyOnGround);
            // NOTE: No isIllegal check here.
            final PlayerLocation pLoc = moveInfo.from;
            moveInfo.from.collectBlockFlags(cc.noFallyOnGround);
            // Be sure not to lose that block.
            data.noFallFallDistance += 1.0;
            // TODO: Accound for liquid too?
            if (!pLoc.isOnGround(1.0, 0.3, 0.1) && !pLoc.isResetCond() && !pLoc.isAboveLadder() && !pLoc.isAboveStairs()) {
                // Likely a new style no-fall bypass (damage in mid-air).
                data.noFallVL += 1.0;
                if (noFall.executeActions(player, data.noFallVL, 1.0, cc.noFallActions, true) && data.hasSetBack()) {
                    // Cancel the event and restore fall distance.
                    // NoFall data will not be reset
View Full Code Here

Examples of fr.neatmonster.nocheatplus.utilities.PlayerLocation

     */
    public static void handleIllegalMove(final PlayerMoveEvent event, final Player player, final MovingData data)
    {
        // This might get extended to a check-like thing.
        boolean restored = false;
        final PlayerLocation pLoc = new PlayerLocation(NCPAPIProvider.getNoCheatPlusAPI().getMCAccess(), null);
        // (Mind that we don't set the block cache here).
        final Location loc = player.getLocation();
        if (!restored && data.hasSetBack()) {
            final Location setBack = data.getSetBack(loc);
            pLoc.set(setBack, player);
            if (!pLoc.isIllegal()) {
                event.setFrom(setBack);
                event.setTo(setBack);
                restored = true;
            }
            else {
                data.resetSetBack();
            }
        }
        if (!restored) {
            pLoc.set(loc, player);
            if (!pLoc.isIllegal()) {
                event.setFrom(loc);
                event.setTo(loc);
                restored = true;
            }
        }
        pLoc.cleanup();
        if (!restored) {
            // TODO: reset the bounding box of the player ?
            if (MovingConfig.getConfig(player).tempKickIllegal) {
                NCPAPIProvider.getNoCheatPlusAPI().denyLogin(player.getName(), 24L * 60L * 60L * 1000L);
                LogUtil.logSevere("[NCP] could not restore location for " + player.getName() + ", kicking them and deny login for 24 hours");
View Full Code Here

Examples of fr.neatmonster.nocheatplus.utilities.PlayerLocation

    public final PlayerLocation from;
    public final PlayerLocation to;
   
    public MoveInfo(final MCAccess mcAccess){
      cache = mcAccess.getBlockCache(null);
      from = new PlayerLocation(mcAccess, null);
      to = new PlayerLocation(mcAccess, null);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.