aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsaga <45262877+saga-00@users.noreply.github.com>2024-08-26 06:08:12 -0300
committerGitHub <noreply@github.com>2024-08-26 11:08:12 +0200
commit35b1a6a1b83a1504605bd5b5d3e4f6fd6e545c8e (patch)
tree911b1da92dfdd7831b616c9b8fa8e9d8710b8fad /src
parentd13954de4de5d9a04380bb4105c13d7ae564255e (diff)
downloadskyhanni-35b1a6a1b83a1504605bd5b5d3e4f6fd6e545c8e.tar.gz
skyhanni-35b1a6a1b83a1504605bd5b5d3e4f6fd6e545c8e.tar.bz2
skyhanni-35b1a6a1b83a1504605bd5b5d3e4f6fd6e545c8e.zip
Feature: "Not any pests" chat filter and "No pests!" title (#1957)
Co-authored-by: Cal <cwolfson58@gmail.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/chat/FilterTypesConfig.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/garden/pests/PestFinderConfig.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt40
4 files changed, 42 insertions, 11 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/chat/FilterTypesConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/chat/FilterTypesConfig.java
index 0187af82e..8898ab68a 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/chat/FilterTypesConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/chat/FilterTypesConfig.java
@@ -106,6 +106,12 @@ public class FilterTypesConfig {
public boolean sacrifice = false;
@Expose
+ @ConfigOption(name = "Garden Pest", desc = "Hide the message of no pests on garden.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean gardenNoPest = false;
+
+ @Expose
@ConfigOption(name = "Block Alpha Achievements", desc = "Hide achievement messages while on the Alpha network.")
@ConfigEditorBoolean
@FeatureToggle
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/pests/PestFinderConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/pests/PestFinderConfig.java
index 20f840084..587bfa73f 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/pests/PestFinderConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/pests/PestFinderConfig.java
@@ -79,6 +79,11 @@ public class PestFinderConfig {
public Position position = new Position(-350, 200, 1.3f);
@Expose
+ @ConfigOption(name = "No Pests Title", desc = "Show a Title in case of No pests. Useful if you are using the §eGarden Pest Chat Filter")
+ @ConfigEditorBoolean
+ public boolean noPestTitle = false;
+
+ @Expose
@ConfigOption(name = "Teleport Hotkey", desc = "Press this key to warp to the nearest plot with pests on it.")
@ConfigEditorKeybind(defaultKey = Keyboard.KEY_NONE)
public int teleportHotkey = Keyboard.KEY_NONE;
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt
index 303f8de37..ada41bab4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt
@@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.features.chat.PowderMiningChatFilter.genericMiningRewardMessage
import at.hannibal2.skyhanni.features.dungeon.DungeonAPI
import at.hannibal2.skyhanni.features.garden.GardenAPI
+import at.hannibal2.skyhanni.features.garden.pests.PestFinder
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.RegexUtils.groupOrNull
@@ -496,6 +497,7 @@ object ChatFilter {
dungeonConfig.soloClass && DungeonAPI.inDungeon() && message.isPresent("solo_class") -> "solo_class"
dungeonConfig.soloStats && DungeonAPI.inDungeon() && message.isPresent("solo_stats") -> "solo_stats"
dungeonConfig.fairy && DungeonAPI.inDungeon() && message.isPresent("fairy") -> "fairy"
+ config.gardenNoPest && GardenAPI.inGarden() && PestFinder.noPestsChatPattern.matches(message) -> "garden_pest"
else -> null
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt
index c508e08a5..d8754fd81 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt
@@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.config.features.garden.pests.PestFinderConfig.VisibilityType
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.IslandChangeEvent
+import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzKeyPressEvent
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.events.garden.pests.PestUpdateEvent
@@ -19,8 +20,10 @@ import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.HypixelCommands
import at.hannibal2.skyhanni.utils.LorenzColor
+import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.NEUItems
+import at.hannibal2.skyhanni.utils.RegexUtils.matches
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
import at.hannibal2.skyhanni.utils.RenderUtils.drawWaypointFilled
import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation
@@ -28,6 +31,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.StringUtils
import at.hannibal2.skyhanni.utils.renderables.Renderable
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraft.client.Minecraft
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -39,6 +43,10 @@ object PestFinder {
private val config get() = PestAPI.config.pestFinder
private var display = emptyList<Renderable>()
+ val noPestsChatPattern by RepoPattern.pattern(
+ "chat.garden.no.pest",
+ "§cThere are not any Pests on your Garden right now! Keep farming!",
+ )
@HandleEvent
fun onPestUpdate(event: PestUpdateEvent) {
@@ -68,26 +76,28 @@ object PestFinder {
"§7Pests Found: §e" + if (isInaccurate) "Unknown" else pests,
"§7In plot §b$plotName",
"",
- "§eClick here to warp!"
+ "§eClick here to warp!",
),
onClick = {
plot.sendTeleportTo()
- }
+ },
)
add(renderable)
}
if (PestAPI.getInfestedPlots().isEmpty() && PestAPI.scoreboardPests != 0) {
add(Renderable.string("§e${PestAPI.scoreboardPests} §6Bugged pests!"))
- add(Renderable.clickAndHover(
- "§cTry opening your plots menu.",
- listOf(
- "Runs /desk."
+ add(
+ Renderable.clickAndHover(
+ "§cTry opening your plots menu.",
+ listOf(
+ "Runs /desk.",
+ ),
+ onClick = {
+ HypixelCommands.gardenDesk()
+ },
),
- onClick = {
- HypixelCommands.gardenDesk()
- }
- ))
+ )
}
}
@@ -151,13 +161,21 @@ object PestFinder {
pests
) + " §c$pestsName §7in §b$plotName"
event.drawDynamicText(
- location, text, 1.5
+ location, text, 1.5,
)
}
private var lastKeyPress = SimpleTimeMark.farPast()
@SubscribeEvent
+ fun onChat(event: LorenzChatEvent) {
+ if (!GardenAPI.inGarden()) return
+ if (!config.noPestTitle) return
+
+ if (noPestsChatPattern.matches(event.message)) LorenzUtils.sendTitle("§eNo pests!", 2.seconds)
+ }
+
+ @SubscribeEvent
fun onKeyClick(event: LorenzKeyPressEvent) {
if (!GardenAPI.inGarden()) return
if (Minecraft.getMinecraft().currentScreen != null) return