From a344f516a8329f4ed8bf8e21dfe68f0c93b795c8 Mon Sep 17 00:00:00 2001 From: Bella Date: Sat, 7 Mar 2020 14:57:04 -0500 Subject: [PATCH] make offhandgap way safer --- .../kami/module/modules/combat/OffhandGap.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/combat/OffhandGap.java b/src/main/java/me/zeroeightsix/kami/module/modules/combat/OffhandGap.java index 1344f51c2..32f749a31 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/combat/OffhandGap.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/combat/OffhandGap.java @@ -34,14 +34,14 @@ public class OffhandGap extends Module { int gaps = -1; boolean autoTotemWasEnabled = false; - boolean notCancelled = false; + boolean cancelled = false; Item usedItem; Item toUseItem; @EventHandler private Listener sendListener = new Listener<>(e ->{ if (e.getPacket() instanceof CPacketPlayerTryUseItem) { - if (mc.player.getHealth() + mc.player.getAbsorptionAmount() <= disableHealth.getValue()) { + if (cancelled) { disableGaps(); return; } @@ -77,9 +77,14 @@ public class OffhandGap extends Module { public void onUpdate() { if (mc.player == null) return; /* If your health doesn't meet the cutoff then set it to true */ - notCancelled = mc.player.getHealth() + mc.player.getAbsorptionAmount() <= disableHealth.getValue(); + cancelled = mc.player.getHealth() + mc.player.getAbsorptionAmount() <= disableHealth.getValue(); toUseItem = Items.GOLDEN_APPLE; + if (cancelled) { + disableGaps(); + return; + } + if (mc.player.getHeldItemOffhand().getItem() != Items.GOLDEN_APPLE) { for (int i = 0; i < 45; i++) { if (mc.player.inventory.getStackInSlot(i).getItem() == Items.GOLDEN_APPLE) {