aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-12 20:46:32 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-12 20:46:32 +0100
commit4c12e4496fc3f6f49430a425cac52ce0b62b3fe5 (patch)
tree1d3c2cbcd795d707056b8916241262d09526f2cd /src/main/java/at/hannibal2/skyhanni
parentf15c00d21e9e7bcd87c4c940803bf68928c06103 (diff)
downloadskyhanni-4c12e4496fc3f6f49430a425cac52ce0b62b3fe5.tar.gz
skyhanni-4c12e4496fc3f6f49430a425cac52ce0b62b3fe5.tar.bz2
skyhanni-4c12e4496fc3f6f49430a425cac52ce0b62b3fe5.zip
Fixed finished city project still reminding and suggests buying items.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt
index ace382885..62aa76289 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt
@@ -82,9 +82,8 @@ class CityProjectFeatures {
fun onInventoryOpen(event: InventoryFullyOpenedEvent) {
if (!LorenzUtils.inSkyBlock) return
- val lore = event.inventoryItems[4]?.getLore() ?: return
- if (lore.isEmpty()) return
- if (lore[0] != "§8City Project") return
+ inInventory = false
+ if (!inCityProject(event)) return
inInventory = true
if (config.showMaterials) {
@@ -104,7 +103,9 @@ class CityProjectFeatures {
for ((_, item) in event.inventoryItems) {
val itemName = item.name ?: continue
- for (line in item.getLore()) {
+ val lore = item.getLore()
+ if (lore.lastOrNull() == "§aProject is being built!") continue
+ for (line in lore) {
contributeAgainPattern.matchMatcher(line) {
val rawTime = group("time")
if (rawTime.contains("Soon!")) return@matchMatcher
@@ -122,6 +123,13 @@ class CityProjectFeatures {
}
}
+ private fun inCityProject(event: InventoryFullyOpenedEvent): Boolean {
+ val lore = event.inventoryItems[4]?.getLore() ?: return false
+ if (lore.isEmpty()) return false
+ if (lore[0] != "§8City Project") return false
+ return true
+ }
+
private fun buildList(materials: MutableMap<String, Int>) = buildList<List<Any>> {
addAsSingletonList("§7City Project Materials")
@@ -154,7 +162,9 @@ class CityProjectFeatures {
private fun fetchMaterials(item: ItemStack, materials: MutableMap<String, Int>) {
var next = false
- for (line in item.getLore()) {
+ val lore = item.getLore()
+ if (lore.lastOrNull() == "§aProject is being built!") return
+ for (line in lore) {
if (line == "§7Cost") {
next = true
continue