about summary refs log blame commit diff
path: root/index.js
blob: e5d23d9dffed6d8898d65c678203453963f6bab2 (plain) (tree)



















                                                                 
exports.plugin = (bot) => {
    var originalFunction = bot._client.write;

    // Create a new function that wraps the original function
    var newFunction = function (name, params) {
        if (name === "entity_action") {
            if (params.actionId === 3 || params.actionId === 4) {
                // cancel sprint start and sprint stop packets
                return;
            }
        }
        if (params.onGround !== undefined) {
            params.onGround = false
        }
        return originalFunction.apply(this, [...arguments])
    }

    // Replace the original function with the new function
    bot._client.write = newFunction;
}