aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-02-05 22:05:53 +0100
committerGitHub <noreply@github.com>2024-02-05 22:05:53 +0100
commitd392c8085486b7d6b3c6a0e0707dd0ffc72224fa (patch)
tree652c4d29914627143168047e472fe9ceb0995276 /src/main
parent9c1352f880dd626d766d1477da4962ae7da457a7 (diff)
downloadskyhanni-d392c8085486b7d6b3c6a0e0707dd0ffc72224fa.tar.gz
skyhanni-d392c8085486b7d6b3c6a0e0707dd0ffc72224fa.tar.bz2
skyhanni-d392c8085486b7d6b3c6a0e0707dd0ffc72224fa.zip
Fix: "Piece of wizard portal earned" shows duplicate somtimes (#982)
Fixed showing the Piece of wizard portal earned duplicate. #982
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt
index fe21f488f..deedd7f98 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt
@@ -3,8 +3,11 @@ package at.hannibal2.skyhanni.features.misc
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.LorenzToolTipEvent
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
+import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getRecipientName
+import at.hannibal2.skyhanni.utils.StringUtils.anyMatches
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class RestorePieceOfWizardPortalLore {
@@ -13,15 +16,15 @@ class RestorePieceOfWizardPortalLore {
private val item by lazy { "WIZARD_PORTAL_MEMENTO".asInternalName() }
+ private val earnedPattern by RepoPattern.pattern("misc.restore.wizard.portal.earned", "§7Earned by:.*")
+
@SubscribeEvent
fun onTooltip(event: LorenzToolTipEvent) {
if (!config.restorePieceOfWizardPortalLore) return
val stack = event.itemStack
if (stack.getInternalName() != item) return
+ if (earnedPattern.anyMatches(stack.getLore())) return
val recipient = stack.getRecipientName() ?: return
- if (!event.toolTip[5].contains(recipient)) {
- event.toolTip.add(5, "§7Earned by: $recipient")
- }
+ event.toolTip.add(5, "§7Earned by: $recipient")
}
-
-} \ No newline at end of file
+}