Package cc.co.evenprime.bukkit.nocheat.data

Examples of cc.co.evenprime.bukkit.nocheat.data.PreciseLocation


    }

    public PreciseLocation check(NoCheatPlayer player, MovingData data, MovingConfig cc) {

        // Some shortcuts:
        final PreciseLocation setBack = data.runflySetBackPoint;
        final PreciseLocation to = data.to;
        final PreciseLocation from = data.from;

        // Calculate some distances
        final double xDistance = data.to.x - from.x;
        final double zDistance = to.z - from.z;
        final double horizontalDistance = Math.sqrt((xDistance * xDistance + zDistance * zDistance));

        if(!setBack.isSet()) {
            setBack.set(from);
        }

        // To know if a player "is on ground" is useful
        final int fromType = CheckUtil.evaluateLocation(player.getPlayer().getWorld(), from);
        final int toType = CheckUtil.evaluateLocation(player.getPlayer().getWorld(), to);

        final boolean fromOnGround = CheckUtil.isOnGround(fromType);
        final boolean fromInGround = CheckUtil.isInGround(fromType);
        final boolean toOnGround = CheckUtil.isOnGround(toType);
        final boolean toInGround = CheckUtil.isInGround(toType);

        PreciseLocation newToLocation = null;

        final double resultHoriz = Math.max(0.0D, checkHorizontal(player, data, CheckUtil.isLiquid(fromType) && CheckUtil.isLiquid(toType), horizontalDistance, cc));
        final double resultVert = Math.max(0.0D, checkVertical(player, data, fromOnGround, toOnGround, cc));

        final double result = (resultHoriz + resultVert) * 100;
 
View Full Code Here


        // 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
View Full Code Here

    public PreciseLocation check(NoCheatPlayer player, MovingData data, MovingConfig ccmoving) {

        // The setBack is the location that players may get teleported to when
        // they fail the check
        final PreciseLocation setBack = data.runflySetBackPoint;

        final PreciseLocation from = data.from;
        final PreciseLocation to = data.to;

        // If we have no setback, define one now
        if(!setBack.isSet()) {
            setBack.set(from);
        }

        // Used to store the location where the player gets teleported to
        PreciseLocation newToLocation = null;

        // Before doing anything, do a basic height check to determine if
        // players are flying too high
        int maxheight = ccmoving.flyingHeightLimit + player.getPlayer().getWorld().getMaxHeight();

        if(to.y - data.vertFreedom > maxheight) {
            newToLocation = new PreciseLocation();
            newToLocation.set(setBack);
            newToLocation.y = maxheight - 10;
            return newToLocation;
        }

        // Calculate some distances
View Full Code Here

     * 5. If there was a long pause (maybe lag), limit may be up to 100
     *
     */
    public PreciseLocation check(NoCheatPlayer player, MovingData data, MovingConfig cc) {

        PreciseLocation newToLocation = null;

        if(!data.morePacketsSetbackPoint.isSet()) {
            data.morePacketsSetbackPoint.set(data.from);
        }

View Full Code Here

    @Override
    public String getParameter(ParameterName wildcard, NoCheatPlayer player) {

        if(wildcard == ParameterName.LOCATION) {
            PreciseLocation from = getData(player).from;
            return String.format(Locale.US, "%.2f,%.2f,%.2f", from.x, from.y, from.z);
        } else if(wildcard == ParameterName.MOVEDISTANCE) {
            PreciseLocation from = getData(player).from;
            PreciseLocation to = getData(player).to;
            return String.format(Locale.US, "%.2f,%.2f,%.2f", to.x - from.x, to.y - from.y, to.z - from.z);
        } else if(wildcard == ParameterName.LOCATION_TO) {
            PreciseLocation to = getData(player).to;
            return String.format(Locale.US, "%.2f,%.2f,%.2f", to.x, to.y, to.z);
        } else
            return super.getParameter(wildcard, player);

    }
View Full Code Here

TOP

Related Classes of cc.co.evenprime.bukkit.nocheat.data.PreciseLocation

Copyright © 2018 www.massapicom. 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.