diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
24 files changed, 223 insertions, 209 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt index d058ddc50..4d9af4c9d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt @@ -519,6 +519,7 @@ object ChatFilter { * @param message The message to check * @return The reason why the message was blocked, empty if not blocked */ + @Suppress("CyclomaticComplexMethod") private fun block(message: String): String? = when { config.hypixelHub && message.isPresent("lobby") -> "lobby" config.empty && StringUtils.isEmpty(message) -> "empty" diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/PowderMiningChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/PowderMiningChatFilter.kt index 698a67114..25c1c04cb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/PowderMiningChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/PowderMiningChatFilter.kt @@ -252,6 +252,7 @@ object PowderMiningChatFilter { "§r§[fa9][❤❈☘⸕✎✧] (?<tier>Rough|Flawed|Fine|Flawless) (?<gem>Ruby|Amethyst|Jade|Amber|Sapphire|Topaz) Gemstone( §r§8x(?<amount>[\\d,]+))?", ) + @Suppress("CyclomaticComplexMethod") fun block(message: String): String? { // Generic "you uncovered a chest" message if (uncoverChestPattern.matches(message)) return "powder_mining_chest" diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt index 957f1ecd0..3b2b93680 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt @@ -441,8 +441,8 @@ object BestiaryData { return true } else if (name == "Search Results") { val loreList = stack.getLore() - if (loreList.size >= 2 && loreList[0].startsWith("§7Query: §a") - && loreList[1].startsWith("§7Results: §a") + if (loreList.size >= 2 && loreList[0].startsWith("§7Query: §a") && + loreList[1].startsWith("§7Results: §a") ) { return true } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt index 0391e40a3..4f0dad4b8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt @@ -67,6 +67,8 @@ import kotlin.time.Duration import kotlin.time.Duration.Companion.seconds @SkyHanniModule +// TODO cut class into smaller pieces +@Suppress("LargeClass") object DamageIndicatorManager { private var mobFinder: MobFinder? = null @@ -75,7 +77,6 @@ object DamageIndicatorManager { private val enderSlayerHitsNumberPattern = ".* §[5fd]§l(?<hits>\\d+) Hits?".toPattern() - private var data = mapOf<UUID, EntityData>() private val damagePattern = "[✧✯]?(\\d+[⚔+✧❤♞☄✷ﬗ✯]*)".toPattern() @@ -288,7 +289,7 @@ object DamageIndicatorManager { BossType.SLAYER_BLAZE_QUAZII_3, BossType.SLAYER_BLAZE_QUAZII_4, - // TODO f3/m3 4 guardians, f2/m2 4 boss room fighters + // TODO f3/m3 4 guardians, f2/m2 4 boss room fighters -> true else -> false diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/MobFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/MobFinder.kt index 975e3b4f8..399040179 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/MobFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/MobFinder.kt @@ -88,11 +88,11 @@ class MobFinder { else -> { when (entity) { /* - * Note that the order does matter here. - * For example, if you put EntityZombie before EntityPigZombie, - * EntityPigZombie will never be reached because EntityPigZombie extends EntityZombie. - * Please take this into consideration if you are to modify this. - */ + * Note that the order does matter here. + * For example, if you put EntityZombie before EntityPigZombie, + * EntityPigZombie will never be reached because EntityPigZombie extends EntityZombie. + * Please take this into consideration if you are to modify this. + */ is EntityOtherPlayerMP -> tryAddEntityOtherPlayerMP(entity) is EntityIronGolem -> tryAddEntityIronGolem(entity) is EntityPigZombie -> tryAddEntityPigZombie(entity) @@ -392,8 +392,8 @@ class MobFinder { } private fun tryAddEntityMagmaCube(entity: EntityLivingBase) = when { - entity.hasNameTagWith(15, "§e﴾ §8[§7Lv500§8] §l§4§lMagma Boss§r ") - && entity.hasMaxHealth(200_000_000, true) -> { + entity.hasNameTagWith(15, "§e﴾ §8[§7Lv500§8] §l§4§lMagma Boss§r ") && + entity.hasMaxHealth(200_000_000, true) -> { EntityResult(bossType = BossType.NETHER_MAGMA_BOSS, ignoreBlocks = true) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt index eca75bc70..308a5b144 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt @@ -99,11 +99,11 @@ object DungeonCleanEnd { if (entity == Minecraft.getMinecraft().thePlayer) return - if (config.F3IgnoreGuardians - && DungeonAPI.isOneOf("F3", "M3") - && entity is EntityGuardian - && entity.entityId != lastBossId - && Minecraft.getMinecraft().thePlayer.isSneaking + if (config.F3IgnoreGuardians && + DungeonAPI.isOneOf("F3", "M3") && + entity is EntityGuardian && + entity.entityId != lastBossId && + Minecraft.getMinecraft().thePlayer.isSneaking ) { return } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt index 2df035702..6831f1440 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt @@ -106,7 +106,7 @@ object EasterEggWaypoints { 'Easter Eggs: §a0/§a30' ' ' '§ewww.hypixel.net' - */ + */ private fun checkScoreboardEasterSpecific(): Boolean { val a = ScoreboardData.sidebarLinesFormatted.any { it.contains("Hypixel Level") } val b = ScoreboardData.sidebarLinesFormatted.any { it.contains("Easter") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt index 7068ef8aa..f97bd56c9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt @@ -91,8 +91,8 @@ object TrophyFishMessages { } private fun shouldBlockTrophyFish(rarity: TrophyRarity, amount: Int) = - config.bronzeHider && rarity == TrophyRarity.BRONZE && amount != 1 - || config.silverHider && rarity == TrophyRarity.SILVER && amount != 1 + config.bronzeHider && rarity == TrophyRarity.BRONZE && amount != 1 || + config.silverHider && rarity == TrophyRarity.SILVER && amount != 1 @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt index fa45e579d..6faa7746a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt @@ -564,18 +564,24 @@ object ComposterOverlay { } } + private val blockedItems = listOf( + "POTION_AFFINITY_TALISMAN", + "CROPIE_TALISMAN", + "SPEED_TALISMAN", + "SIMPLE_CARROT_CANDY", + ) + + private fun isBlockedArmor(internalName: String): Boolean { + return internalName.endsWith("_BOOTS") || + internalName.endsWith("_HELMET") || + internalName.endsWith("_CHESTPLATE") || + internalName.endsWith("_LEGGINGS") + } + private fun updateOrganicMatterFactors(baseValues: Map<NEUInternalName, Double>): Map<NEUInternalName, Double> { val map = mutableMapOf<NEUInternalName, Double>() for ((internalName, _) in NEUItems.allNeuRepoItems()) { - if (internalName == "POTION_AFFINITY_TALISMAN" - || internalName == "CROPIE_TALISMAN" - || internalName.endsWith("_BOOTS") - || internalName.endsWith("_HELMET") - || internalName.endsWith("_CHESTPLATE") - || internalName.endsWith("_LEGGINGS") - || internalName == "SPEED_TALISMAN" - || internalName == "SIMPLE_CARROT_CANDY" - ) continue + if (blockedItems.contains(internalName) || isBlockedArmor(internalName)) continue var (newId, amount) = NEUItems.getPrimitiveMultiplier(internalName.asInternalName()) if (amount <= 9) continue diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/OverviewPage.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/OverviewPage.kt index b05acf959..00e994f7d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/OverviewPage.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/OverviewPage.kt @@ -21,8 +21,9 @@ class OverviewPage(sizeX: Int, sizeY: Int, paddingX: Int = 15, paddingY: Int = 7 update(content, footer) } - // TODO split up this 240 lines function - fun getPage(): Pair<List<List<Renderable>>, List<Renderable>> { + // TODO split up this 240 lines function - remove suppression when done + @Suppress("CyclomaticComplexMethod", "LongMethod") + private fun getPage(): Pair<List<List<Renderable>>, List<Renderable>> { val content = mutableListOf<MutableList<Renderable>>() val footer = mutableListOf<Renderable>() val timeUntilCakes = FFStats.cakeExpireTime.timeUntil().format(TimeUnit.HOUR, maxUnits = 1) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/HighlightVisitorsOutsideOfGarden.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/HighlightVisitorsOutsideOfGarden.kt index 8a8c11165..a413f295a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/HighlightVisitorsOutsideOfGarden.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/HighlightVisitorsOutsideOfGarden.kt @@ -62,8 +62,8 @@ object HighlightVisitorsOutsideOfGarden { val possibleJsons = visitorJson[mode] ?: return false val skinOrType = getSkinOrTypeFor(entity) return possibleJsons.any { - (it.position == null || it.position.distance(entity.position.toLorenzVec()) < 1) - && it.skinOrType == skinOrType + (it.position == null || it.position.distance(entity.position.toLorenzVec()) < 1) && + it.skinOrType == skinOrType } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/MovableHotBar.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/MovableHotBar.kt index cf49749b2..bee90a696 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/MovableHotBar.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/MovableHotBar.kt @@ -39,6 +39,6 @@ object MovableHotBar { } fun isEnabled(): Boolean = - (LorenzUtils.inSkyBlock || (Minecraft.getMinecraft().thePlayer != null && config.showOutsideSkyblock)) - && config.editable + (LorenzUtils.inSkyBlock || (Minecraft.getMinecraft().thePlayer != null && config.showOutsideSkyblock)) && + config.editable } diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt index 7636d43eb..0289a3c81 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt @@ -491,8 +491,8 @@ private fun getHeatDisplayPair(): List<ScoreboardElementType> { ) } -private fun getHeatShowWhen() = inAnyIsland(IslandType.CRYSTAL_HOLLOWS) - && CustomScoreboard.activeLines.any { ScoreboardPattern.heatPattern.matches(it) } +private fun getHeatShowWhen() = inAnyIsland(IslandType.CRYSTAL_HOLLOWS) && + CustomScoreboard.activeLines.any { ScoreboardPattern.heatPattern.matches(it) } private fun getColdDisplayPair(): List<ScoreboardElementType> { val cold = -MiningAPI.cold diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvent.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvent.kt index 9f3c009e5..3b3b6448b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvent.kt @@ -372,9 +372,9 @@ private fun getWinterLines() = buildList { } private fun getWinterShowWhen(): Boolean = getSbLines().any { - ScoreboardPattern.winterEventStartPattern.matches(it) - || (ScoreboardPattern.winterNextWavePattern.matches(it) && !it.endsWith("Soon!")) - || ScoreboardPattern.winterWavePattern.matches(it) + ScoreboardPattern.winterEventStartPattern.matches(it) || + (ScoreboardPattern.winterNextWavePattern.matches(it) && !it.endsWith("Soon!")) || + ScoreboardPattern.winterWavePattern.matches(it) } private fun getNewYearLines() = listOf(getSbLines().first { SbPattern.newYearPattern.matches(it) }) @@ -444,8 +444,8 @@ private fun getBroodmotherLines(): List<String> = private fun getMiningEventsLines() = buildList { // Wind - if (getSbLines().any { SbPattern.windCompassPattern.matches(it) } - && getSbLines().any { SbPattern.windCompassArrowPattern.matches(it) }) { + if (getSbLines().any { SbPattern.windCompassPattern.matches(it) } && + getSbLines().any { SbPattern.windCompassArrowPattern.matches(it) }) { add(getSbLines().first { SbPattern.windCompassPattern.matches(it) }) add("| ${getSbLines().first { SbPattern.windCompassArrowPattern.matches(it) }} §f|") } @@ -457,15 +457,15 @@ private fun getMiningEventsLines() = buildList { } // Zone Events - if (getSbLines().any { SbPattern.miningEventPattern.matches(it) } - && getSbLines().any { SbPattern.miningEventZonePattern.matches(it) }) { + if (getSbLines().any { SbPattern.miningEventPattern.matches(it) } && + getSbLines().any { SbPattern.miningEventZonePattern.matches(it) }) { add(getSbLines().first { SbPattern.miningEventPattern.matches(it) }.removePrefix("Event: ")) add("in ${getSbLines().first { SbPattern.miningEventZonePattern.matches(it) }.removePrefix("Zone: ")}") } // Zone Events but no Zone Line - if (getSbLines().any { SbPattern.miningEventPattern.matches(it) } - && getSbLines().none { SbPattern.miningEventZonePattern.matches(it) }) { + if (getSbLines().any { SbPattern.miningEventPattern.matches(it) } && + getSbLines().none { SbPattern.miningEventZonePattern.matches(it) }) { add( getSbLines().first { SbPattern.miningEventPattern.matches(it) } .removePrefix("Event: "), @@ -473,22 +473,22 @@ private fun getMiningEventsLines() = buildList { } // Mithril Gourmand - if (getSbLines().any { SbPattern.mithrilRemainingPattern.matches(it) } - && getSbLines().any { SbPattern.mithrilYourMithrilPattern.matches(it) }) { + if (getSbLines().any { SbPattern.mithrilRemainingPattern.matches(it) } && + getSbLines().any { SbPattern.mithrilYourMithrilPattern.matches(it) }) { add(getSbLines().first { SbPattern.mithrilRemainingPattern.matches(it) }) add(getSbLines().first { SbPattern.mithrilYourMithrilPattern.matches(it) }) } // Raffle - if (getSbLines().any { SbPattern.raffleTicketsPattern.matches(it) } - && getSbLines().any { SbPattern.rafflePoolPattern.matches(it) }) { + if (getSbLines().any { SbPattern.raffleTicketsPattern.matches(it) } && + getSbLines().any { SbPattern.rafflePoolPattern.matches(it) }) { add(getSbLines().first { SbPattern.raffleTicketsPattern.matches(it) }) add(getSbLines().first { SbPattern.rafflePoolPattern.matches(it) }) } // Raid - if (getSbLines().any { SbPattern.yourGoblinKillsPattern.matches(it) } - && getSbLines().any { SbPattern.remainingGoblinPattern.matches(it) }) { + if (getSbLines().any { SbPattern.yourGoblinKillsPattern.matches(it) } && + getSbLines().any { SbPattern.remainingGoblinPattern.matches(it) }) { add(getSbLines().first { SbPattern.yourGoblinKillsPattern.matches(it) }) add(getSbLines().first { SbPattern.remainingGoblinPattern.matches(it) }) } @@ -509,17 +509,17 @@ private fun getDamageLines(): List<String> = (getSbLines().first { SbPattern.bossDamagePattern.matches(it) }) private fun getDamageShowWhen(): Boolean = - getSbLines().any { SbPattern.bossHPPattern.matches(it) } - && getSbLines().any { SbPattern.bossDamagePattern.matches(it) } + getSbLines().any { SbPattern.bossHPPattern.matches(it) } && + getSbLines().any { SbPattern.bossDamagePattern.matches(it) } private fun getMagmaBossLines() = getSbLines().filter { line -> - SbPattern.magmaBossPattern.matches(line) - || SbPattern.damageSoakedPattern.matches(line) - || SbPattern.killMagmasPattern.matches(line) - || SbPattern.killMagmasDamagedSoakedBarPattern.matches(line) - || SbPattern.reformingPattern.matches(line) - || SbPattern.bossHealthPattern.matches(line) - || SbPattern.bossHealthBarPattern.matches(line) + SbPattern.magmaBossPattern.matches(line) || + SbPattern.damageSoakedPattern.matches(line) || + SbPattern.killMagmasPattern.matches(line) || + SbPattern.killMagmasDamagedSoakedBarPattern.matches(line) || + SbPattern.reformingPattern.matches(line) || + SbPattern.bossHealthPattern.matches(line) || + SbPattern.bossHealthBarPattern.matches(line) } private fun getMagmaBossShowWhen(): Boolean = SbPattern.magmaChamberPattern.matches(HypixelData.skyBlockArea) @@ -542,15 +542,15 @@ private fun getCarnivalLines() = listOf( private fun getCarnivalShowWhen(): Boolean = SbPattern.carnivalPattern.anyMatches(getSbLines()) private fun getRiftLines() = getSbLines().filter { line -> - RiftBloodEffigies.heartsPattern.matches(line) - || SbPattern.riftHotdogTitlePattern.matches(line) - || SbPattern.timeLeftPattern.matches(line) - || SbPattern.riftHotdogEatenPattern.matches(line) - || SbPattern.riftAveikxPattern.matches(line) - || SbPattern.riftHayEatenPattern.matches(line) - || SbPattern.cluesPattern.matches(line) - || SbPattern.barryProtestorsQuestlinePattern.matches(line) - || SbPattern.barryProtestorsHandledPattern.matches(line) + RiftBloodEffigies.heartsPattern.matches(line) || + SbPattern.riftHotdogTitlePattern.matches(line) || + SbPattern.timeLeftPattern.matches(line) || + SbPattern.riftHotdogEatenPattern.matches(line) || + SbPattern.riftAveikxPattern.matches(line) || + SbPattern.riftHayEatenPattern.matches(line) || + SbPattern.cluesPattern.matches(line) || + SbPattern.barryProtestorsQuestlinePattern.matches(line) || + SbPattern.barryProtestorsHandledPattern.matches(line) } private fun getEssenceLines(): List<String> = listOf(getSbLines().first { SbPattern.essencePattern.matches(it) }) diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt index fa693f648..38612f297 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt @@ -16,128 +16,130 @@ object UnknownLinesHandler { internal lateinit var remoteOnlyPatterns: Array<Pattern> + /** + * Remove known lines with patterns + **/ + private val patternsToExclude = mutableListOf( + PurseAPI.coinsPattern, + SbPattern.motesPattern, + BitsAPI.bitsScoreboardPattern, + SbPattern.heatPattern, + SbPattern.copperPattern, + SbPattern.locationPattern, + SbPattern.lobbyCodePattern, + SbPattern.datePattern, + SbPattern.timePattern, + SbPattern.footerPattern, + SbPattern.yearVotesPattern, + SbPattern.votesPattern, + SbPattern.waitingForVotePattern, + SbPattern.northstarsPattern, + SbPattern.profileTypePattern, + SbPattern.autoClosingPattern, + SbPattern.startingInPattern, + SbPattern.timeElapsedPattern, + SbPattern.instanceShutdownPattern, + SbPattern.keysPattern, + SbPattern.clearedPattern, + SbPattern.soloPattern, + SbPattern.teammatesPattern, + SbPattern.floor3GuardiansPattern, + SbPattern.m7dragonsPattern, + SbPattern.wavePattern, + SbPattern.tokensPattern, + SbPattern.submergesPattern, + SbPattern.medalsPattern, + SbPattern.lockedPattern, + SbPattern.cleanUpPattern, + SbPattern.pastingPattern, + SbPattern.peltsPattern, + SbPattern.mobLocationPattern, + SbPattern.jacobsContestPattern, + SbPattern.plotPattern, + SbPattern.powderGreedyPattern, + SbPattern.windCompassPattern, + SbPattern.windCompassArrowPattern, + SbPattern.miningEventPattern, + SbPattern.miningEventZonePattern, + SbPattern.raffleUselessPattern, + SbPattern.raffleTicketsPattern, + SbPattern.rafflePoolPattern, + SbPattern.mithrilUselessPattern, + SbPattern.mithrilRemainingPattern, + SbPattern.mithrilYourMithrilPattern, + SbPattern.nearbyPlayersPattern, + SbPattern.uselessGoblinPattern, + SbPattern.remainingGoblinPattern, + SbPattern.yourGoblinKillsPattern, + SbPattern.magmaBossPattern, + SbPattern.damageSoakedPattern, + SbPattern.killMagmasPattern, + SbPattern.killMagmasDamagedSoakedBarPattern, + SbPattern.reformingPattern, + SbPattern.bossHealthPattern, + SbPattern.bossHealthBarPattern, + SbPattern.broodmotherPattern, + SbPattern.bossHPPattern, + SbPattern.bossDamagePattern, + SbPattern.slayerQuestPattern, + SbPattern.essencePattern, + SbPattern.redstonePattern, + SbPattern.anniversaryPattern, + SbPattern.visitingPattern, + SbPattern.flightDurationPattern, + SbPattern.dojoChallengePattern, + SbPattern.dojoDifficultyPattern, + SbPattern.dojoPointsPattern, + SbPattern.dojoTimePattern, + SbPattern.objectivePattern, + ServerRestartTitle.restartingGreedyPattern, + SbPattern.travelingZooPattern, + SbPattern.newYearPattern, + SbPattern.spookyPattern, + SbPattern.winterEventStartPattern, + SbPattern.winterNextWavePattern, + SbPattern.winterWavePattern, + SbPattern.winterMagmaLeftPattern, + SbPattern.winterTotalDmgPattern, + SbPattern.winterCubeDmgPattern, + SbPattern.riftDimensionPattern, + RiftBloodEffigies.heartsPattern, + SbPattern.wtfAreThoseLinesPattern, + SbPattern.timeLeftPattern, + SbPattern.darkAuctionCurrentItemPattern, + SbPattern.coldPattern, + SbPattern.riftHotdogTitlePattern, + SbPattern.riftHotdogEatenPattern, + SbPattern.mineshaftNotStartedPattern, + SbPattern.queuePattern, + SbPattern.queueTierPattern, + SbPattern.queuePositionPattern, + SbPattern.fortunateFreezingBonusPattern, + SbPattern.riftAveikxPattern, + SbPattern.riftHayEatenPattern, + SbPattern.fossilDustPattern, + SbPattern.cluesPattern, + SbPattern.barryProtestorsQuestlinePattern, + SbPattern.barryProtestorsHandledPattern, + SbPattern.carnivalPattern, + SbPattern.carnivalTasksPattern, + SbPattern.carnivalTokensPattern, + SbPattern.carnivalFruitsPattern, + SbPattern.carnivalScorePattern, + SbPattern.carnivalCatchStreakPattern, + SbPattern.carnivalAccuracyPattern, + SbPattern.carnivalKillsPattern, + ) + private var remoteOnlyPatternsAdded = false + fun handleUnknownLines() { val sidebarLines = CustomScoreboard.activeLines var unknownLines = sidebarLines.map { it.removeResets() }.filter { it.isNotBlank() }.filter { it.trim().length > 3 } - /** - * Remove known lines with patterns - **/ - val patternsToExclude = mutableListOf( - PurseAPI.coinsPattern, - SbPattern.motesPattern, - BitsAPI.bitsScoreboardPattern, - SbPattern.heatPattern, - SbPattern.copperPattern, - SbPattern.locationPattern, - SbPattern.lobbyCodePattern, - SbPattern.datePattern, - SbPattern.timePattern, - SbPattern.footerPattern, - SbPattern.yearVotesPattern, - SbPattern.votesPattern, - SbPattern.waitingForVotePattern, - SbPattern.northstarsPattern, - SbPattern.profileTypePattern, - SbPattern.autoClosingPattern, - SbPattern.startingInPattern, - SbPattern.timeElapsedPattern, - SbPattern.instanceShutdownPattern, - SbPattern.keysPattern, - SbPattern.clearedPattern, - SbPattern.soloPattern, - SbPattern.teammatesPattern, - SbPattern.floor3GuardiansPattern, - SbPattern.m7dragonsPattern, - SbPattern.wavePattern, - SbPattern.tokensPattern, - SbPattern.submergesPattern, - SbPattern.medalsPattern, - SbPattern.lockedPattern, - SbPattern.cleanUpPattern, - SbPattern.pastingPattern, - SbPattern.peltsPattern, - SbPattern.mobLocationPattern, - SbPattern.jacobsContestPattern, - SbPattern.plotPattern, - SbPattern.powderGreedyPattern, - SbPattern.windCompassPattern, - SbPattern.windCompassArrowPattern, - SbPattern.miningEventPattern, - SbPattern.miningEventZonePattern, - SbPattern.raffleUselessPattern, - SbPattern.raffleTicketsPattern, - SbPattern.rafflePoolPattern, - SbPattern.mithrilUselessPattern, - SbPattern.mithrilRemainingPattern, - SbPattern.mithrilYourMithrilPattern, - SbPattern.nearbyPlayersPattern, - SbPattern.uselessGoblinPattern, - SbPattern.remainingGoblinPattern, - SbPattern.yourGoblinKillsPattern, - SbPattern.magmaBossPattern, - SbPattern.damageSoakedPattern, - SbPattern.killMagmasPattern, - SbPattern.killMagmasDamagedSoakedBarPattern, - SbPattern.reformingPattern, - SbPattern.bossHealthPattern, - SbPattern.bossHealthBarPattern, - SbPattern.broodmotherPattern, - SbPattern.bossHPPattern, - SbPattern.bossDamagePattern, - SbPattern.slayerQuestPattern, - SbPattern.essencePattern, - SbPattern.redstonePattern, - SbPattern.anniversaryPattern, - SbPattern.visitingPattern, - SbPattern.flightDurationPattern, - SbPattern.dojoChallengePattern, - SbPattern.dojoDifficultyPattern, - SbPattern.dojoPointsPattern, - SbPattern.dojoTimePattern, - SbPattern.objectivePattern, - ServerRestartTitle.restartingGreedyPattern, - SbPattern.travelingZooPattern, - SbPattern.newYearPattern, - SbPattern.spookyPattern, - SbPattern.winterEventStartPattern, - SbPattern.winterNextWavePattern, - SbPattern.winterWavePattern, - SbPattern.winterMagmaLeftPattern, - SbPattern.winterTotalDmgPattern, - SbPattern.winterCubeDmgPattern, - SbPattern.riftDimensionPattern, - RiftBloodEffigies.heartsPattern, - SbPattern.wtfAreThoseLinesPattern, - SbPattern.timeLeftPattern, - SbPattern.darkAuctionCurrentItemPattern, - SbPattern.coldPattern, - SbPattern.riftHotdogTitlePattern, - SbPattern.riftHotdogEatenPattern, - SbPattern.mineshaftNotStartedPattern, - SbPattern.queuePattern, - SbPattern.queueTierPattern, - SbPattern.queuePositionPattern, - SbPattern.fortunateFreezingBonusPattern, - SbPattern.riftAveikxPattern, - SbPattern.riftHayEatenPattern, - SbPattern.fossilDustPattern, - SbPattern.cluesPattern, - SbPattern.barryProtestorsQuestlinePattern, - SbPattern.barryProtestorsHandledPattern, - SbPattern.carnivalPattern, - SbPattern.carnivalTasksPattern, - SbPattern.carnivalTokensPattern, - SbPattern.carnivalFruitsPattern, - SbPattern.carnivalScorePattern, - SbPattern.carnivalCatchStreakPattern, - SbPattern.carnivalAccuracyPattern, - SbPattern.carnivalKillsPattern, - ) - - if (::remoteOnlyPatterns.isInitialized) { + if (::remoteOnlyPatterns.isInitialized && !remoteOnlyPatternsAdded) { patternsToExclude.addAll(remoteOnlyPatterns) + remoteOnlyPatternsAdded = true } unknownLines = unknownLines.filterNot { line -> diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/SuperpairExperimentInformationDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/SuperpairExperimentInformationDisplay.kt index b1ee56659..cb3102ca8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/SuperpairExperimentInformationDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/SuperpairExperimentInformationDisplay.kt @@ -16,8 +16,8 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.milliseconds -@SkyHanniModule // TODO important: all use cases of listOf in combination with string needs to be gone. no caching, constant new list creation, and bad design. +@SkyHanniModule object SuperpairExperimentInformationDisplay { private val config get() = SkyHanniMod.feature.inventory.experimentationTable diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/SuperpairsClicksAlert.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/SuperpairsClicksAlert.kt index ef99c40ba..6c35eb5b1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/SuperpairsClicksAlert.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/SuperpairsClicksAlert.kt @@ -47,13 +47,12 @@ object SuperpairsClicksAlert { if (!targetInventoryNames.any { event.inventoryName.contains(it) }) return if ( // checks if we have succeeded in either minigame - (event.inventoryName.contains("Chronomatron") - && ((event.inventoryItems[4]?.displayName?.removeColor() + (event.inventoryName.contains("Chronomatron") && + ((event.inventoryItems[4]?.displayName?.removeColor() ?.let { currentRoundRegex.find(it) } - ?.groups?.get(1)?.value?.toInt() ?: -1) > roundsNeeded)) - - || (event.inventoryName.contains("Ultrasequencer") - && event.inventoryItems.entries + ?.groups?.get(1)?.value?.toInt() ?: -1) > roundsNeeded)) || + (event.inventoryName.contains("Ultrasequencer") && + event.inventoryItems.entries .filter { it.key < 45 } .any { it.value.stackSize > roundsNeeded }) ) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt index 5748220c5..5abf8679a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt @@ -364,8 +364,8 @@ object ItemAbilityCooldown { if (message == "§dCreeper Veil §r§aActivated!") { ItemAbility.WITHER_CLOAK.activate(LorenzColor.LIGHT_PURPLE) } - if (message == "§dCreeper Veil §r§cDe-activated! §r§8(Expired)" - || message == "§cNot enough mana! §r§dCreeper Veil §r§cDe-activated!" + if (message == "§dCreeper Veil §r§cDe-activated! §r§8(Expired)" || + message == "§cNot enough mana! §r§dCreeper Veil §r§cDe-activated!" ) { ItemAbility.WITHER_CLOAK.activate() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt index 94b292fdf..057d2f476 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt @@ -103,8 +103,8 @@ object KingTalismanHelper { skyblockYear = SkyBlockTime.now().year } - fun isEnabled() = config.enabled && LorenzUtils.inSkyBlock - && (IslandType.DWARVEN_MINES.isInIsland() || config.outsideMines) + fun isEnabled() = config.enabled && LorenzUtils.inSkyBlock && + (IslandType.DWARVEN_MINES.isInIsland() || config.outsideMines) @SubscribeEvent fun onInventoryOpen(event: InventoryFullyOpenedEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt index 05b1eaf35..d5129a5fb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt @@ -78,8 +78,8 @@ object MarkedPlayerManager { fun isMarkedPlayer(player: String): Boolean = player.lowercase() in playerNamesToMark - private fun isEnabled() = (LorenzUtils.inSkyBlock || OutsideSbFeature.MARKED_PLAYERS.isSelected()) - && config.highlightInWorld + private fun isEnabled() = (LorenzUtils.inSkyBlock || OutsideSbFeature.MARKED_PLAYERS.isSelected()) && + config.highlightInWorld fun replaceInChat(string: String): String { if (!config.highlightInChat) return string diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt index fddb5bbda..3f56230c4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt @@ -62,6 +62,8 @@ import io.github.notenoughupdates.moulconfig.observer.Property import net.minecraft.item.ItemStack import java.util.Locale +// TODO split into smaler sub classes +@Suppress("LargeClass") object EstimatedItemValueCalculator { private val config get() = SkyHanniMod.feature.inventory.estimatedItemValues @@ -129,12 +131,13 @@ object EstimatedItemValueCalculator { return Pair(totalPrice, basePrice) } - private fun isKuudraSet(internalName: String) = (kuudraSets.any { internalName.contains(it) } && listOf( - "CHESTPLATE", - "LEGGINGS", - "HELMET", - "BOOTS", - ).any { internalName.endsWith(it) }) + private fun isKuudraSet(internalName: String) = (kuudraSets.any { internalName.contains(it) } && + listOf( + "CHESTPLATE", + "LEGGINGS", + "HELMET", + "BOOTS", + ).any { internalName.endsWith(it) }) private fun addAttributeCost(stack: ItemStack, list: MutableList<String>): Double { val attributes = stack.getAttributes() ?: return 0.0 diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigOptionGui.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigOptionGui.kt index bbe40db5c..1ebbaed68 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigOptionGui.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigOptionGui.kt @@ -81,8 +81,8 @@ class DefaultConfigOptionGui( fun button(title: String, tooltip: List<String>, func: () -> Unit) { val width = mc.fontRendererObj.getStringWidth(title) var overMouse = false - if (mouseX - ((this.width - xSize) / 2 + padding) in i..(i + width) - && mouseY - (height + ySize) / 2 in -barSize..0 + if (mouseX - ((this.width - xSize) / 2 + padding) in i..(i + width) && + mouseY - (height + ySize) / 2 in -barSize..0 ) { overMouse = true hoveringTextToDraw = tooltip diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/ModifyVisualWords.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/ModifyVisualWords.kt index 8999ba074..8f7551573 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/ModifyVisualWords.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/ModifyVisualWords.kt @@ -54,7 +54,7 @@ object ModifyVisualWords { it.groupValues[1] + it.groupValues[2].reversed() } } - */ + */ modifiedText } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt index 4ff57d73d..77807e5bf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt @@ -38,8 +38,8 @@ object VoltHighlighter { fun onArmorChange(event: EntityEquipmentChangeEvent) { if (!RiftAPI.inRift() || !config.voltWarning) return val player = Minecraft.getMinecraft().thePlayer ?: return - if (event.isHead && getVoltState(event.entity) == VoltState.DOING_LIGHTNING - && event.entity.positionVector.squareDistanceTo(player.positionVector) <= LIGHTNING_DISTANCE * LIGHTNING_DISTANCE + if (event.isHead && getVoltState(event.entity) == VoltState.DOING_LIGHTNING && + event.entity.positionVector.squareDistanceTo(player.positionVector) <= LIGHTNING_DISTANCE * LIGHTNING_DISTANCE ) { chargingSince = chargingSince.editCopy { this[event.entity] = SimpleTimeMark.now() |