var scriptName = "ILoveTowerScaffold";
var scriptVersion = 1.4;
var scriptAuthor = "yorik100, EzHacksYT";
var towerModule = moduleManager.getModule("Tower");
var scaffoldModule = moduleManager.getModule("Scaffold");
var S12PacketEntityVelocity = Java.type('net.minecraft.network.play.server.S12PacketEntityVelocity');
var S27PacketExplosion = Java.type('net.minecraft.network.play.server.S27PacketExplosion');

var towerScaffold = new TowerScaffold();

var client;

function TowerScaffold() {
    this.getName = function() {
        return "TowerScaffold";
    };

    this.getDescription = function() {
        return "Scaffold Addon";
    };

    this.getCategory = function() {
        return "World";
    };
    this.onJump = function(event) {
        if (!mc.gameSettings.keyBindLeft.isKeyDown() && !mc.gameSettings.keyBindRight.isKeyDown() && !mc.gameSettings.keyBindForward.isKeyDown() && !mc.gameSettings.keyBindBack.isKeyDown()) {
            event.cancelEvent()
        }
    }
    this.onMove = function(event) {
        if (mc.gameSettings.keyBindJump.isKeyDown() && !mc.gameSettings.keyBindLeft.isKeyDown() && !mc.gameSettings.keyBindRight.isKeyDown() && !mc.gameSettings.keyBindForward.isKeyDown() && !mc.gameSettings.keyBindBack.isKeyDown()) {
            mc.thePlayer.motionX = 0;
            mc.thePlayer.motionZ = 0;
            event.setX(0);
            event.setZ(0);
            towerModule.setState(true)
            scaffoldModule.setState(false)
        } else {
            towerModule.setState(false)
            scaffoldModule.setState(true)
        }
    }
    this.onDisable = function() {
        towerModule.setState(false)
        scaffoldModule.setState(false)
    }
}

function onLoad() {}

function onEnable() {
    client = moduleManager.registerModule(towerScaffold);
}

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