summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-08-31 21:05:12 +0200
committerGitHub <noreply@github.com>2024-08-31 21:05:12 +0200
commit8ac1f15304f50dc5c2e973dbae5bd7b1a0a31bd1 (patch)
tree038f9b2c3c4164b48acaebc67372d0908e479cc7 /src/main/java/at/hannibal2/skyhanni/features
parent79602bf7761cb51efcff4ccb1c1d13bed5742fd1 (diff)
downloadskyhanni-8ac1f15304f50dc5c2e973dbae5bd7b1a0a31bd1.tar.gz
skyhanni-8ac1f15304f50dc5c2e973dbae5bd7b1a0a31bd1.tar.bz2
skyhanni-8ac1f15304f50dc5c2e973dbae5bd7b1a0a31bd1.zip
Improvement: Warning rancher chat command (#2413)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt
index 5eb89a138..337f64675 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt
@@ -8,9 +8,13 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.ConditionalUtils
+import at.hannibal2.skyhanni.utils.HypixelCommands
+import at.hannibal2.skyhanni.utils.InventoryUtils
+import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.isRancherSign
+import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
import at.hannibal2.skyhanni.utils.SimpleTimeMark
@@ -33,6 +37,7 @@ object GardenOptimalSpeed {
private var sneakingTime = 0.seconds
private val sneaking get() = Minecraft.getMinecraft().thePlayer.isSneaking
private val sneakingPersistent get() = sneakingSince.passedSince() > 5.seconds
+ private val rancherBoots = "RANCHERS_BOOTS".asInternalName()
/**
* This speed value represents the walking speed, not the speed stat.
@@ -175,21 +180,26 @@ object GardenOptimalSpeed {
if (speed != currentSpeed && !recentlySwitchedTool && !recentlyStartedSneaking) warn(speed)
}
- private fun warn(speed: Int) {
+ private fun warn(optimalSpeed: Int) {
if (!Minecraft.getMinecraft().thePlayer.onGround) return
if (GardenAPI.onBarnPlot) return
if (!config.warning) return
+ if (!GardenAPI.isCurrentlyFarming()) return
+ if (InventoryUtils.getBoots()?.getInternalNameOrNull() != rancherBoots) return
if (lastWarnTime.passedSince() < 20.seconds) return
lastWarnTime = SimpleTimeMark.now()
LorenzUtils.sendTitle("§cWrong speed!", 3.seconds)
- cropInHand?.let {
- var text = "Wrong speed for ${it.cropName}: §f$currentSpeed"
- if (sneaking) text += " §7[Sneaking]"
- text += " §e(§f$speed §eis optimal)"
-
- ChatUtils.chat(text)
- }
+ val cropInHand = cropInHand ?: return
+
+ var text = "§cWrong speed while farming ${cropInHand.cropName} detected!"
+ text += "\n§eCurrent Speed: §f$currentSpeed§e, Optimal Speed: §f$optimalSpeed"
+ ChatUtils.clickToActionOrDisable(
+ text,
+ config::warning,
+ actionName = "change the speed",
+ action = { HypixelCommands.setMaxSpeed() },
+ )
}
private fun isRancherOverlayEnabled() = GardenAPI.inGarden() && config.signEnabled