KurtisAD/NoVa-SRC

Automated message in anti-afk

Closed this issue · 1 comments

package nova.modules;

import net.minecraft.client.Minecraft;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import nova.Command;
import nova.events.EventHandler;
import nova.events.PlayerTickEvent;

import java.util.Random;

/**

  • Created by Skeleton Man on 7/17/2016 modified by 2F4U on 1/14/17.
    */

public class ModuleAntiAfk extends ModuleBase{

private BlockPos block;
private Random random;
private BlockPos nextBlock;

private Long currentMS;
private Long lastMs;

public ModuleAntiAfk(nova.Nova Nova, Minecraft mc) {

int timerchat = 0;

@EventHandler
public void onUpdate(PlayerTickEvent e)
{
    if (this.isEnabled) {
        timerchat++;
        currentMS = System.currentTimeMillis();

        if(currentMS >= lastMs + 3000|| nextBlock == null)
        {
            if(block == null)
                onEnable();
            nextBlock =
                    block.add(random.nextInt(3) - 1, 0, random.nextInt(3) - 1);
            lastMs = System.currentTimeMillis();
        }
        faceBlockClientHorizontally(nextBlock);
        mc.gameSettings.keyBindForward.pressed = getHorizontalPlayerBlockDistance(nextBlock) > 0.75;

        if (timerchat >= 250) {
            mc.player.sendChatMessage ("> AFK!")
            timerchat =0;
        }

    }

modifications to the onUpdate() and the class declaration

This is not an issue