From d8c5531cb75372e05a1f0c6432b1a2d38893dee0 Mon Sep 17 00:00:00 2001 From: onixiya1337 <47077455+onixiya1337@users.noreply.github.com> Date: Fri, 22 Dec 2023 15:03:18 +0100 Subject: [PATCH] Bug fixes --- gradle.properties | 2 +- .../farmhelperv2/config/FarmHelperConfig.java | 4 +--- .../farmhelperv2/feature/impl/AutoCookie.java | 4 +--- .../feature/impl/PestsDestroyer.java | 16 +++++----------- .../farmhelperv2/feature/impl/VisitorsMacro.java | 8 ++------ 5 files changed, 10 insertions(+), 24 deletions(-) diff --git a/gradle.properties b/gradle.properties index 72b007b36..68f17154b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,5 +4,5 @@ baseGroup=com.jelly.farmhelperv2 mcVersion=1.8.9 modid=farmhelperv2 modName=FarmHelper -version=2.2.9-pre1 +version=2.2.9-pre2 shouldRelease=true diff --git a/src/main/java/com/jelly/farmhelperv2/config/FarmHelperConfig.java b/src/main/java/com/jelly/farmhelperv2/config/FarmHelperConfig.java index 43641253e..541b5d665 100644 --- a/src/main/java/com/jelly/farmhelperv2/config/FarmHelperConfig.java +++ b/src/main/java/com/jelly/farmhelperv2/config/FarmHelperConfig.java @@ -392,9 +392,7 @@ public class FarmHelperConfig extends Config { text = "Sell Inventory Now" ) Runnable autoSellFunction = () -> { - if (mc.currentScreen != null && mc.thePlayer != null) { - PlayerUtils.closeScreen(); - } + PlayerUtils.closeScreen(); AutoSell.getInstance().enable(true); }; diff --git a/src/main/java/com/jelly/farmhelperv2/feature/impl/AutoCookie.java b/src/main/java/com/jelly/farmhelperv2/feature/impl/AutoCookie.java index 56ff5c464..4403f769b 100644 --- a/src/main/java/com/jelly/farmhelperv2/feature/impl/AutoCookie.java +++ b/src/main/java/com/jelly/farmhelperv2/feature/impl/AutoCookie.java @@ -95,9 +95,7 @@ public void stop() { activating = false; autoCookieDelay.reset(); timeoutClock.reset(); - if (mc.currentScreen != null && mc.thePlayer != null) { - PlayerUtils.closeScreen(); - } + PlayerUtils.closeScreen(); KeyBindUtils.stopMovement(); if (MacroHandler.getInstance().isMacroToggled()) MacroHandler.getInstance().resumeMacro(); diff --git a/src/main/java/com/jelly/farmhelperv2/feature/impl/PestsDestroyer.java b/src/main/java/com/jelly/farmhelperv2/feature/impl/PestsDestroyer.java index 2a4acbd45..404c6fe14 100644 --- a/src/main/java/com/jelly/farmhelperv2/feature/impl/PestsDestroyer.java +++ b/src/main/java/com/jelly/farmhelperv2/feature/impl/PestsDestroyer.java @@ -117,11 +117,6 @@ public boolean shouldStartAtMacroStart() { @Override public void start() { if (enabled) return; - if (!mc.thePlayer.capabilities.allowFlying) { - LogUtils.sendError("[Pests Destroyer] You need to be able to fly!"); - FarmHelperConfig.enablePestsDestroyer = false; - return; - } lastKilledEntity = null; preparing = true; if (MacroHandler.getInstance().isMacroToggled()) { @@ -152,9 +147,7 @@ public void stop() { } } lastKilledEntity = null; - if (mc.currentScreen != null && mc.thePlayer != null) { - PlayerUtils.closeScreen(); - } + PlayerUtils.closeScreen(); resetStatesAfterMacroDisabled(); KeyBindUtils.stopMovement(); } @@ -204,16 +197,17 @@ public boolean canEnableMacro(boolean manually) { LogUtils.sendError("[Pests Destroyer] You need higher tier (at least second) of Vacuum to use Pests Destroyer!"); return false; } - + if (!mc.thePlayer.capabilities.allowFlying) { + LogUtils.sendError("[Pests Destroyer] You need to be able to fly!"); + return false; + } if (manually) { return true; } - if (!PlayerUtils.isStandingOnSpawnPoint() && !PlayerUtils.isStandingOnRewarpLocation()) { LogUtils.sendError("[Pests Destroyer] You need to be standing on spawn point or rewarp point to use Pests Destroyer!"); return false; } - return true; } diff --git a/src/main/java/com/jelly/farmhelperv2/feature/impl/VisitorsMacro.java b/src/main/java/com/jelly/farmhelperv2/feature/impl/VisitorsMacro.java index ab04106e5..7a3bf8110 100644 --- a/src/main/java/com/jelly/farmhelperv2/feature/impl/VisitorsMacro.java +++ b/src/main/java/com/jelly/farmhelperv2/feature/impl/VisitorsMacro.java @@ -168,9 +168,7 @@ public void stop() { manuallyStarted = false; LogUtils.sendDebug("[Visitors Macro] Macro stopped"); rotation.reset(); - if (mc.currentScreen != null && mc.thePlayer != null) { - PlayerUtils.closeScreen(); - } + PlayerUtils.closeScreen(); KeyBindUtils.stopMovement(); BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().cancelEverything(); } @@ -1411,9 +1409,7 @@ public void onReceiveChat(ClientChatReceivedEvent event) { } if (buyState == BuyState.CLICK_CROP || buyState == BuyState.OPEN_BZ) { if (msg.startsWith("You need the Cookie Buff")) { - if (mc.currentScreen != null && mc.thePlayer != null) { - PlayerUtils.closeScreen(); - } + PlayerUtils.closeScreen(); LogUtils.sendDebug("[Visitors Macro] Cookie buff is needed. Skipping..."); setBuyState(BuyState.NONE); setVisitorsState(VisitorsState.NONE);