var scriptName = "mineplex";
var scriptVersion = 1.0;
var scriptAuthor = "scorpion3013";
var strafeModule = moduleManager.getModule("Strafe");
var ogstate
var bufferSpeedModule = moduleManager.getModule("BufferSpeed");
var otstate
var noFallModule = moduleManager.getModule("NoFall");
var opstate
var safeWalkModule = moduleManager.getModule("SafeWalk");
var okstate
var C06PlayerPacket = Java.type('net.minecraft.network.play.client.C03PacketPlayer.C06PacketPlayerPosLook');
 
script.import("minecraftUtils.js");
 
 // Converts from degrees to radians.
 Math.radians = function(degrees) {
    return degrees * Math.PI / 180;
  };
 
  // Converts from radians to degrees.
  Math.degrees = function(radians) {
    return radians * 180 / Math.PI;
  };
 
function vClip(offset) {
    mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + offset, mc.thePlayer.posZ);
}
 
function hClip(offset) {
    var playerYaw = Math.radians(mc.thePlayer.rotationYaw);
    mc.thePlayer.setPosition(mc.thePlayer.posX - (Math.sin(playerYaw) * offset), mc.thePlayer.posY, mc.thePlayer.posZ + (Math.cos(playerYaw) * offset));
}
 
function MineplexHighJump3() {
    this.getName = function () {
        return "MineplexHighJumpBig";
    };
 
    this.getDescription = function () {
        return "Mineplex Highjump with biggest boost";
    };
 
    this.getCategory = function () {
        return "Movement";
    };
 
    var keepo = false;
    this.onEnable = function () {
        if (mc.thePlayer.onGround){
        opstate = noFallModule.getState()
        mc.thePlayer.sendQueue.addToSendQueue(new C06PlayerPacket(mc.thePlayer.posX, (mc.thePlayer.posY - 9.95), mc.thePlayer.posZ, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, true));
        mc.thePlayer.sendQueue.addToSendQueue(new C06PlayerPacket(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, true));
        mc.thePlayer.motionY = 7.5;
		keepo = true;
        ogstate = strafeModule.getState()
        if (ogstate) {
        strafeModule.setState(false)}
        otstate = betterSpeedModule.getState() 
        if (otstate) {
        bufferSpeedModule.setState(false)}
        }else{
		var autoDisableModule = moduleManager.getModule("MineplexHighJumpBig");
		autoDisableModule.setState(false);
		}
    }
    var yes = false;
    var kappa = false;
    var ticks = 0
    this.onUpdate = function () {
        if (!mc.thePlayer.onGround && keepo == true){
        if (kappa == false){
        this.yaw = mc.thePlayer.prevRotationYawHead;
            kappa = true
        }
				mc.timer.timerSpeed = 1.05;
                mc.thePlayer.setSprinting(true);
                mc.thePlayer.motionX = 0;
                mc.thePlayer.motionZ = 0;
				if (ticks > 1){
                mc.thePlayer.jumpMovementFactor = 0.51;
				}
				if (ticks < 2){
				mc.thePlayer.jumpMovementFactor = 0;
				}
				if (mc.thePlayer.motionY >= 0){
				if (mc.thePlayer.motionY < 0.43){
				mc.thePlayer.motionY += 0.039675;
				}
				}
				if (mc.thePlayer.motionY < 0){
				if ((!mc.thePlayer.moveForward == 0 || !mc.thePlayer.moveStrafing == 0) && !mc.thePlayer.onGround){
				if (mc.thePlayer.fallDistance <= 2.5){
				mc.thePlayer.motionY += 0.03;
				}
				if (mc.thePlayer.fallDistance > 2.5){
				mc.thePlayer.motionY += 0.01;
				}
				}
				if ((mc.thePlayer.moveForward == 0 && mc.thePlayer.moveStrafing == 0) && !mc.thePlayer.onGround){
				if (mc.thePlayer.fallDistance <= 0.04){
				mc.thePlayer.motionY += 0.0025;
				}
				if (mc.thePlayer.fallDistance > 0.04 && mc.thePlayer.fallDistance <= 2.5){
				mc.thePlayer.motionY += 0.03;
				}
				if (mc.thePlayer.fallDistance > 2.5){
				mc.thePlayer.motionY += 0.01;
				}
				}
				}
                hookKeyBind(mc.gameSettings.keyBindRight, "myKeyBindRight");
                hookKeyBind(mc.gameSettings.keyBindLeft, "myKeyBindLeft");
                hookKeyBind(mc.gameSettings.keyBindBack, "myKeyBindBack");
                mc.thePlayer.rotationYaw = this.yaw;
        }else{
            unhookAllKeyBinds()
            kappa = false
            mc.timer.timerSpeed = 1;
        }
           ticks++;
             if (ticks > 1 && (mc.thePlayer.onGround || mc.thePlayer.isCollidedHorizontally || mc.thePlayer.isCollidedVertically)){
				 var autoDisableModule = moduleManager.getModule("MineplexHighJumpBig");
				 autoDisableModule.setState(false);
        }
	}
    this.onDisable = function () {
        yes = false;
        toggling = false;
        kappa = false;
		keepo = false;
        ticks = 0
        mc.timer.timerSpeed = 1;
        unhookAllKeyBinds();
        if (ogstate) {
        strafeModule.setState(true)
        }
        if (otstate) {
        bufferSpeedModule.setState(true)}
        okstate = safeWalkModule.getState()
        if (!safeWalkStateBefore)
        {
            if (okstate) {
            safeWalkModule.setState(false)}
        }
    }
}
 
function MineplexHighJump2() {
    this.getName = function () {
        return "MineplexHighJumpSmall";
    };
 
    this.getDescription = function () {
        return "Mineplex Highjump with lower boost";
    };
 
    this.getCategory = function () {
        return "Movement";
    };
    var keepo = false;
    this.onEnable = function () {
        if (mc.thePlayer.onGround){
        opstate = noFallModule.getState()
        mc.thePlayer.sendQueue.addToSendQueue(new C06PlayerPacket(mc.thePlayer.posX, (mc.thePlayer.posY - 9.95), mc.thePlayer.posZ, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, true));
        mc.thePlayer.sendQueue.addToSendQueue(new C06PlayerPacket(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, true));
        mc.thePlayer.motionY = 2.10;
		keepo = true;
        ogstate = strafeModule.getState()
        if (ogstate) {
        strafeModule.setState(false)}
        otstate = betterSpeedModule.getState() 
        if (otstate) {
        bufferSpeedModule.setState(false)}
        }else{
		var autoDisableModule = moduleManager.getModule("MineplexHighJumpSmall");
		autoDisableModule.setState(false);
		}
    }
    var yes = false;
    var kappa = false;
    var ticks = 0
    this.onUpdate = function () {
        if (!mc.thePlayer.onGround && keepo == true){
        if (kappa == false){
        this.yaw = mc.thePlayer.prevRotationYawHead;
            kappa = true
        }
				mc.timer.timerSpeed = 1.05;
                mc.thePlayer.setSprinting(true);
                mc.thePlayer.motionX = 0;
                mc.thePlayer.motionZ = 0;
				if (ticks > 1){
                mc.thePlayer.jumpMovementFactor = 0.51;
				}
				if (ticks < 2){
				mc.thePlayer.jumpMovementFactor = 0;
				}
				if (mc.thePlayer.motionY >= 0){
				if (mc.thePlayer.motionY < 0.43){
				mc.thePlayer.motionY += 0.039675;
				}
				}
				if (mc.thePlayer.motionY < 0){
				if ((!mc.thePlayer.moveForward == 0 || !mc.thePlayer.moveStrafing == 0) && !mc.thePlayer.onGround){
				if (mc.thePlayer.fallDistance <= 2.5){
				mc.thePlayer.motionY += 0.03;
				}
				if (mc.thePlayer.fallDistance > 2.5){
				mc.thePlayer.motionY += 0.01;
				}
				}
				if ((mc.thePlayer.moveForward == 0 && mc.thePlayer.moveStrafing == 0) && !mc.thePlayer.onGround){
				if (mc.thePlayer.fallDistance <= 0.04){
				mc.thePlayer.motionY += 0.0025;
				}
				if (mc.thePlayer.fallDistance > 0.04 && mc.thePlayer.fallDistance <= 2.5){
				mc.thePlayer.motionY += 0.03;
				}
				if (mc.thePlayer.fallDistance > 2.5){
				mc.thePlayer.motionY += 0.01;
				}
				}
				}
                hookKeyBind(mc.gameSettings.keyBindRight, "myKeyBindRight");
                hookKeyBind(mc.gameSettings.keyBindLeft, "myKeyBindLeft");
                hookKeyBind(mc.gameSettings.keyBindBack, "myKeyBindBack");
                mc.thePlayer.rotationYaw = this.yaw;
        }else{
            unhookAllKeyBinds()
            kappa = false
            mc.timer.timerSpeed = 1;
        }
           ticks++;
             if (ticks > 1 && (mc.thePlayer.onGround || mc.thePlayer.isCollidedHorizontally || mc.thePlayer.isCollidedVertically)){
				 var autoDisableModule = moduleManager.getModule("MineplexHighJumpSmall");
				 autoDisableModule.setState(false);
        }
	}
    this.onDisable = function () {
        yes = false;
        toggling = false;
        kappa = false;
		keepo = false;
        ticks = 0;
        mc.timer.timerSpeed = 1;
        unhookAllKeyBinds();
        if (ogstate) {
        strafeModule.setState(true)
        }
        if (otstate) {
        bufferSpeedModule.setState(true)}
        okstate = safeWalkModule.getState()
        if (!safeWalkStateBefore)
        {
            if (okstate) {
            safeWalkModule.setState(false)}
        }
    }
}
 
function MineplexHighJump() {
    this.getName = function () {
        return "MineplexHighJump";
    };
 
    this.getDescription = function () {
        return "Mineplex Highjump";
    };
 
    this.getCategory = function () {
        return "Movement";
    };
 
 
    var keepo = false;
    this.onEnable = function () {
        if (mc.thePlayer.onGround){
        opstate = noFallModule.getState()
        mc.thePlayer.sendQueue.addToSendQueue(new C06PlayerPacket(mc.thePlayer.posX, (mc.thePlayer.posY - 9.95), mc.thePlayer.posZ, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, true));
        mc.thePlayer.sendQueue.addToSendQueue(new C06PlayerPacket(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, true));
        mc.thePlayer.motionY = 4.75;
		keepo = true;
        ogstate = strafeModule.getState()
        if (ogstate) {
        strafeModule.setState(false)}
        otstate = betterSpeedModule.getState() 
        if (otstate) {
        bufferSpeedModule.setState(false)}
        }else{
		var autoDisableModule = moduleManager.getModule("MineplexHighJump");
		autoDisableModule.setState(false);
		}
    }
    var yes = false;
    var kappa = false;
    var ticks = 0
    this.onUpdate = function () {
        if (!mc.thePlayer.onGround && keepo == true){
        if (kappa == false){
        this.yaw = mc.thePlayer.prevRotationYawHead;
            kappa = true
        }
				mc.timer.timerSpeed = 1.05;
                mc.thePlayer.setSprinting(true);
                mc.thePlayer.motionX = 0;
                mc.thePlayer.motionZ = 0;
				if (ticks > 1){
                mc.thePlayer.jumpMovementFactor = 0.51;
				}
				if (ticks < 2){
				mc.thePlayer.jumpMovementFactor = 0;
				}
				if (mc.thePlayer.motionY >= 0){
				if (mc.thePlayer.motionY < 0.43){
				mc.thePlayer.motionY += 0.039675;
				}
				}
				if (mc.thePlayer.motionY < 0){
				if ((!mc.thePlayer.moveForward == 0 || !mc.thePlayer.moveStrafing == 0) && !mc.thePlayer.onGround){
				if (mc.thePlayer.fallDistance <= 2.5){
				mc.thePlayer.motionY += 0.03;
				}
				if (mc.thePlayer.fallDistance > 2.5){
				mc.thePlayer.motionY += 0.01;
				}
				}
				if ((mc.thePlayer.moveForward == 0 && mc.thePlayer.moveStrafing == 0) && !mc.thePlayer.onGround){
				if (mc.thePlayer.fallDistance <= 0.04){
				mc.thePlayer.motionY += 0.0025;
				}
				if (mc.thePlayer.fallDistance > 0.04 && mc.thePlayer.fallDistance <= 2.5){
				mc.thePlayer.motionY += 0.03;
				}
				if (mc.thePlayer.fallDistance > 2.5){
				mc.thePlayer.motionY += 0.01;
				}
				}
				}
                hookKeyBind(mc.gameSettings.keyBindRight, "myKeyBindRight");
                hookKeyBind(mc.gameSettings.keyBindLeft, "myKeyBindLeft");
                hookKeyBind(mc.gameSettings.keyBindBack, "myKeyBindBack");
                mc.thePlayer.rotationYaw = this.yaw;
        }else{
            unhookAllKeyBinds()
            kappa = false
            mc.timer.timerSpeed = 1;
        }
           ticks++;
             if (ticks > 1 && (mc.thePlayer.onGround || mc.thePlayer.isCollidedHorizontally || mc.thePlayer.isCollidedVertically)){
				 var autoDisableModule = moduleManager.getModule("MineplexHighJump");
				 autoDisableModule.setState(false);
        }
	}
    this.onDisable = function () {
        yes = false;
        toggling = false;
        kappa = false;
		keepo = false;
        ticks = 0
        mc.timer.timerSpeed = 1;
        unhookAllKeyBinds();
        if (ogstate) {
        strafeModule.setState(true)
        }
        if (otstate) {
        bufferSpeedModule.setState(true)}
        okstate = safeWalkModule.getState()
        if (!safeWalkStateBefore)
        {
            if (okstate) {
            safeWalkModule.setState(false)}
        }
    }
}
 
 
 
 
 
 
 
//Modules and commands register
var mineplexHighJump3 = new MineplexHighJump3();
var mineplexHighJump3Client;
 
var mineplexHighJump2 = new MineplexHighJump2();
var mineplexHighJump2Client;
 
var mineplexHighJump = new MineplexHighJump();
var mineplexHighJumpClient;
 
 
function onLoad() {
 
};
 
function onEnable() {
    mineplexHighJump3Client = moduleManager.registerModule(mineplexHighJump3);
    mineplexHighJump2Client = moduleManager.registerModule(mineplexHighJump2);
    mineplexHighJumpClient = moduleManager.registerModule(mineplexHighJump);
 
 
};
 
function onDisable() {
    moduleManager.unregisterModule(mineplexHighJump3Client);
    moduleManager.unregisterModule(mineplexHighJump2Client);
    moduleManager.unregisterModule(mineplexHighJumpClient);
};