var scriptName = "AntiFall"; 
var scriptVersion = 1.0; 
var scriptAuthor = "soulplexis";

// I used a ticks var, don't get mad at me.

var highJump = new HighJump();
var highJumpClient;

function HighJump() {
	var ticks = 0;
    this.getName = function() {
        return "AntiFall";
    };

    this.getDescription = function() {
        return "Flags you up if you fall.";
    };

    this.getCategory = function() {
        return "Movement";
    };

    this.onUpdate = function() {
		if(!mc.thePlayer.onGround) {
			ticks++;
		} else {
			ticks = 0;
		}
		if(mc.thePlayer.motionY <= -0.46 && ticks >= 17) {
			mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.3, mc.thePlayer.posZ)
    	}
	}
    this.onDisable = function() {
    	mc.thePlayer.motionY = 0.0;
    }
}

function onLoad() {
};

function onEnable() {
    highJumpClient = moduleManager.registerModule(highJump);
};

function onDisable() {
    moduleManager.unregisterModule(highJumpClient);
};