aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authormartimavocado <39881008+martimavocado@users.noreply.github.com>2024-06-13 18:39:04 +0100
committerGitHub <noreply@github.com>2024-06-13 19:39:04 +0200
commit9d3913018df1ee642a0ddc17d68a5c3c6bda8055 (patch)
treec1e3ed5638a885be72b202af58aecba93fe6758f /src/main/java/at
parent79506c86071f2f8ade0c36f88c2487206747f340 (diff)
downloadskyhanni-9d3913018df1ee642a0ddc17d68a5c3c6bda8055.tar.gz
skyhanni-9d3913018df1ee642a0ddc17d68a5c3c6bda8055.tar.bz2
skyhanni-9d3913018df1ee642a0ddc17d68a5c3c6bda8055.zip
Fix: Stranded Placable NPCs (#2071)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/stranded/HighlightPlaceableNpcs.kt25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/stranded/HighlightPlaceableNpcs.kt b/src/main/java/at/hannibal2/skyhanni/features/stranded/HighlightPlaceableNpcs.kt
index c5bab7fc8..82d57cac6 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/stranded/HighlightPlaceableNpcs.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/stranded/HighlightPlaceableNpcs.kt
@@ -21,9 +21,24 @@ object HighlightPlaceableNpcs {
private val config get() = SkyHanniMod.feature.misc.stranded
- private val locationPattern by RepoPattern.pattern(
- "stranded.highlightplacement.location",
- "§7Location: §f\\[§e\\d+§f, §e\\d+§f, §e\\d+§f]"
+ private val patternGroup = RepoPattern.group("stranded.highlightplacement")
+
+ // TODO Please add regex tests
+ private val locationPattern by patternGroup.pattern(
+ "location",
+ "§7Location: §f\\[§e\\d+§f, §e\\d+§f, §e\\d+§f]",
+ )
+
+ // TODO Please add regex tests
+ private val clickToSetPattern by RepoPattern.pattern(
+ "clicktoset",
+ "§7§eClick to set the location of this NPC!",
+ )
+
+ // TODO Please add regex tests
+ private val clickToSpawnPattern by RepoPattern.pattern(
+ "clicktospawn",
+ "§elocation!",
)
private var inInventory = false
@@ -69,7 +84,9 @@ object HighlightPlaceableNpcs {
private fun isPlaceableNpc(lore: List<String>): Boolean {
// Checking if NPC & placeable
- if (lore.isEmpty() || !(lore.last() == "§ethis NPC!" || lore.last() == "§eyour location!")) {
+ if (lore.isEmpty() ||
+ !(clickToSetPattern.matches(lore.last()) ||
+ clickToSpawnPattern.matches(lore.last()))) {
return false
}