aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-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