From fcc9af9e3bafca5f34fa32e7b9cd30fa10d4c6b0 Mon Sep 17 00:00:00 2001 From: d1gress <55198830+d1gress@users.noreply.github.com> Date: Mon, 25 Nov 2019 22:12:44 +0800 Subject: [PATCH] Added new checks to prevent situational breaking (#123) --- .../kami/module/modules/misc/AutoQMain.java | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/misc/AutoQMain.java b/src/main/java/me/zeroeightsix/kami/module/modules/misc/AutoQMain.java index 31102763..b4c17ef3 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/misc/AutoQMain.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/misc/AutoQMain.java @@ -3,38 +3,28 @@ package me.zeroeightsix.kami.module.modules.misc; import me.zeroeightsix.kami.module.Module; import me.zeroeightsix.kami.module.ModuleManager; import me.zeroeightsix.kami.command.Command; -import me.zeroeightsix.kami.setting.Setting; -import me.zeroeightsix.kami.setting.Settings; import net.minecraft.client.Minecraft; import net.minecraft.network.play.client.CPacketChatMessage; /** * Created by d1gress/Qther on 24/11/2019. - * Updated by @S-B99 on 24/11/2019 */ @Module.Info(name = "AutoQMain", description = "Automatically does \"/queue main\" every 7.1 minutes.", category = Module.Category.MISC) public class AutoQMain extends Module { - private Setting debug = register(Settings.b("Debug", true)); - private static long startTime = 0; @Override public void onUpdate() { - if (mc.player == null) { - return; - } if (Minecraft.getMinecraft().getCurrentServerData() == null || (Minecraft.getMinecraft().getCurrentServerData() !=null && !Minecraft.getMinecraft().getCurrentServerData().serverIP.equalsIgnoreCase("2b2t.org"))) { - Command.sendChatMessage("Not connected to 2b2t.org"); + Command.sendChatMessage("Not on 2b2t"); + startTime = 0; ModuleManager.getModuleByName("AutoQMain").disable(); - } - else { - if (startTime == 0) startTime = System.currentTimeMillis(); - if (startTime + 426000 <= System.currentTimeMillis()) { //426000 - if (debug.getValue()) { - Command.sendChatMessage("&7Run &b/queue main&7 at " + System.currentTimeMillis()); - } + } else { + if (startTime == 0 || startTime <= System.currentTimeMillis() - 427000) startTime = System.currentTimeMillis(); + if (startTime + 426000 <= System.currentTimeMillis()) { Minecraft.getMinecraft().playerController.connection.sendPacket(new CPacketChatMessage("/queue main")); + Command.sendChatMessage("Sent \"/queue main\" at " + System.currentTimeMillis()); startTime = System.currentTimeMillis(); } }