From cc97aefbd4399d341c9f604b629971d65866908d Mon Sep 17 00:00:00 2001 From: onixiya1337 <47077455+onixiya1337@users.noreply.github.com> Date: Sat, 31 Aug 2024 15:06:15 +0200 Subject: [PATCH] Fixed testing failsafes --- gradle.properties | 2 +- .../farmhelperv2/config/FarmHelperConfig.java | 16 ++++++++--- .../page/FailsafeNotificationsPage.java | 28 ------------------- 3 files changed, 13 insertions(+), 33 deletions(-) diff --git a/gradle.properties b/gradle.properties index b25ce66c..6de5c80e 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.8.9-pre7 +version=2.8.9-pre8 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 d6d66e5f..2c9ba8a0 100644 --- a/src/main/java/com/jelly/farmhelperv2/config/FarmHelperConfig.java +++ b/src/main/java/com/jelly/farmhelperv2/config/FarmHelperConfig.java @@ -10,7 +10,10 @@ import com.jelly.farmhelperv2.config.page.CustomFailsafeMessagesPage; import com.jelly.farmhelperv2.config.page.FailsafeNotificationsPage; import com.jelly.farmhelperv2.config.struct.Rewarp; +import com.jelly.farmhelperv2.failsafe.Failsafe; import com.jelly.farmhelperv2.failsafe.FailsafeManager; +import com.jelly.farmhelperv2.failsafe.impl.BedrockCageFailsafe; +import com.jelly.farmhelperv2.failsafe.impl.DirtFailsafe; import com.jelly.farmhelperv2.feature.impl.*; import com.jelly.farmhelperv2.feature.impl.Proxy.ProxyType; import com.jelly.farmhelperv2.gui.AutoUpdaterGUI; @@ -485,17 +488,22 @@ public class FarmHelperConfig extends Config { } LogUtils.sendWarning("Testing failsafe..."); PlayerUtils.closeScreen(); - if (testFailsafeType == 0) { - FailsafeManager.getInstance().possibleDetection(FailsafeManager.getInstance().failsafes.get(testFailsafeType)); + Failsafe testingFailsafe = FailsafeManager.getInstance().failsafes.get(testFailsafeType); + if (testingFailsafe.equals(DirtFailsafe.getInstance()) || testingFailsafe.equals(BedrockCageFailsafe.getInstance())) { + LogUtils.sendError("You can't test this failsafe because it requires specific conditions to trigger!"); return; } - FailsafeManager.getInstance().possibleDetection(FailsafeManager.getInstance().failsafes.get(testFailsafeType + 2)); + FailsafeManager.getInstance().possibleDetection(testingFailsafe); }; @Dropdown(name = "Test Failsafe Type", category = FAILSAFE, subcategory = "Testing", description = "Select failsafe scenario to test", options = { + "Bad Effects", "Banwave", + "Bedrock Cage", + "Cobweb", + "Dirt", "Disconnect", "Evacuate", "Full Inventory", @@ -503,7 +511,7 @@ public class FarmHelperConfig extends Config { "Item Change", "Jacob", "Knockback", - "Low BPS", + "Lower Average BPS", "Rotation", "Teleport", "World Change" diff --git a/src/main/java/com/jelly/farmhelperv2/config/page/FailsafeNotificationsPage.java b/src/main/java/com/jelly/farmhelperv2/config/page/FailsafeNotificationsPage.java index 47e0e04e..a15b93fb 100644 --- a/src/main/java/com/jelly/farmhelperv2/config/page/FailsafeNotificationsPage.java +++ b/src/main/java/com/jelly/farmhelperv2/config/page/FailsafeNotificationsPage.java @@ -101,13 +101,6 @@ public class FailsafeNotificationsPage { ) public static boolean notifyOnJacobFailsafe = false; - @Switch( - name = "Test Notifications", - description = "Whether or not to send a notification when the Test failsafe is triggered.", - category = "Failsafe Notifications" - ) - public static boolean notifyOnTestFailsafe = true; - @Switch( name = "Lower Average BPS Notifications", description = "Whether or not to send a notification when the average BPS is lower than the specified value.", @@ -227,13 +220,6 @@ public class FailsafeNotificationsPage { ) public static boolean alertOnFullInventory = false; - @Switch( - name = "Test Alert", - description = "Whether or not to play a sound when the Test failsafe is triggered.", - category = "Failsafe Sound Alerts" - ) - public static boolean alertOnTestFailsafe = true; - @Switch( name = "Lower Average BPS Alert", description = "Whether or not to play a sound when the average BPS is lower than the specified value.", @@ -347,13 +333,6 @@ public class FailsafeNotificationsPage { ) public static boolean tagEveryoneOnJacobFailsafe = false; - @Switch( - name = "Test Tag Everyone", - description = "Whether or not to tag everyone in the webhook message when the Test failsafe is triggered.", - category = "Failsafe Tag Everyone" - ) - public static boolean tagEveryoneOnTestFailsafe = true; - @Switch( name = "Lower Average BPS Tag Everyone", description = "Whether or not to tag everyone in the webhook message when the average BPS is lower than the specified value.", @@ -466,13 +445,6 @@ public class FailsafeNotificationsPage { ) public static boolean autoAltTabOnJacobFailsafe = false; - @Switch( - name = "Test Auto Alt-tab", - description = "Whether or not to automatically alt-tab when the Test failsafe is triggered.", - category = "Failsafe Auto Alt-tab" - ) - public static boolean autoAltTabOnTestFailsafe = true; - @Switch( name = "Lower Average BPS Alt-tab", description = "Whether or not to automatically alt-tab when the average BPS is lower than the specified value.",