diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt | 13 |
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 +} |