Skip to content

Commit

Permalink
Fix all regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidArthurCole committed Oct 18, 2024
1 parent 005e65e commit e7961e3
Show file tree
Hide file tree
Showing 18 changed files with 32 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.config.core.elements

import net.minecraft.client.gui.Gui

@Suppress("EmptyFunctionBlock", "UnusedParameter")
abstract class GuiElement : Gui() {
abstract fun render(x: Int, y: Int)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import at.hannibal2.skyhanni.events.EntityMoveEvent
import at.hannibal2.skyhanni.events.IslandChangeEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.SkyHanniWarpEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.SkyHanniWarpEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.DelayedRun
import at.hannibal2.skyhanni.utils.LorenzUtils
Expand Down
17 changes: 9 additions & 8 deletions src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ class RepoManager(private val configLocation: File) {
return "${config.location.user}/${config.location.name}/${config.location.branch}"
}

private val defaultUser = "hannibal002"
private val defaultName = "SkyHanni-REPO"
private val defaultBranch = "main"
private const val DEFAULT_USER = "hannibal002"
private const val DEFAULT_NAME = "SkyHanni-REPO"
private const val DEFAULT_BRANCH = "main"

fun RepositoryConfig.RepositoryLocation.hasDefaultSettings() = user == defaultUser && name == defaultName && branch == defaultBranch
fun RepositoryConfig.RepositoryLocation.hasDefaultSettings() =
user == DEFAULT_USER && name == DEFAULT_NAME && branch == DEFAULT_BRANCH
}

fun loadRepoInformation() {
Expand Down Expand Up @@ -246,7 +247,7 @@ class RepoManager(private val configLocation: File) {
).asComponent(),
)
text.add("§7Repo Auto Update Value: §c${config.repoAutoUpdate}".asComponent())
text.add("§7Backup Repo Value: §c${usingBackupRepo}".asComponent())
text.add("§7Backup Repo Value: §c$usingBackupRepo".asComponent())
text.add("§7If you have Repo Auto Update turned off, please try turning that on.".asComponent())
text.add("§cUnsuccessful Constants §7(${unsuccessfulConstants.size}):".asComponent())

Expand Down Expand Up @@ -333,9 +334,9 @@ class RepoManager(private val configLocation: File) {
return
}

user = defaultUser
name = defaultName
branch = defaultBranch
user = DEFAULT_USER
name = DEFAULT_NAME
branch = DEFAULT_BRANCH
if (manual) {
ChatUtils.clickableChat(
"Reset Repo settings to default. " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import org.lwjgl.input.Keyboard
@SkyHanniModule
object HoppityRabbitTheFishChecker {

//<editor-fold desc="Patterns">
// <editor-fold desc="Patterns">
/**
* REGEX-TEST: Chocolate Breakfast Egg
* REGEX-TEST: Chocolate Lunch Egg
Expand All @@ -46,7 +46,7 @@ object HoppityRabbitTheFishChecker {
"inventory.mealegg.continue",
"(?:§.)*Click to open Chocolate Factory!",
)
//</editor-fold>
// </editor-fold>

private val config get() = SkyHanniMod.feature.event.hoppityEggs
private var rabbitTheFishIndex: Int? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import at.hannibal2.skyhanni.config.features.gui.customscoreboard.DisplayConfig
import at.hannibal2.skyhanni.data.BitsAPI
import at.hannibal2.skyhanni.data.HypixelData
import at.hannibal2.skyhanni.data.PurseAPI
import at.hannibal2.skyhanni.data.model.TabWidget
import at.hannibal2.skyhanni.data.ScoreboardData
import at.hannibal2.skyhanni.data.model.TabWidget
import at.hannibal2.skyhanni.features.bingo.BingoAPI
import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.displayConfig
import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardLine.Companion.align
Expand All @@ -18,6 +18,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeResets
import at.hannibal2.skyhanni.utils.StringUtils.trimWhiteSpace
import java.util.regex.Pattern

@Suppress("TooManyFunctions")
object CustomScoreboardUtils {

private fun getGroup(pattern: Pattern, list: List<String>, group: String) =
Expand Down Expand Up @@ -50,7 +51,7 @@ object CustomScoreboardUtils {
internal fun getPurseEarned() = getGroup(PurseAPI.coinsPattern, getSbLines(), "earned")?.let { " §7(§e+$it§7)§6" }

internal fun getBank() = TabWidget.BANK.matchMatcherFirstLine {
group("amount") + (groupOrNull("personal")?.let { " §7/ §6$it" } ?: "")
group("amount") + (groupOrNull("personal")?.let { " §7/ §6$it" }.orEmpty())
} ?: "0"

internal fun getBits() = formatNumber(BitsAPI.bits.coerceAtLeast(0))
Expand All @@ -69,7 +70,7 @@ object CustomScoreboardUtils {

internal fun getNorthStars() = getGroup(ScoreboardPattern.northstarsPattern, getSbLines(), "northStars") ?: "0"

internal fun getTimeSymbol() = getGroup(ScoreboardPattern.timePattern, getSbLines(), "symbol") ?: ""
internal fun getTimeSymbol() = getGroup(ScoreboardPattern.timePattern, getSbLines(), "symbol").orEmpty()

internal fun getTablistEvent() = TabWidget.EVENT.matchMatcherFirstLine { groupOrNull("color") + group("event") }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.features.gui.customscoreboard

import at.hannibal2.skyhanni.features.gui.customscoreboard.events.ScoreboardEvent
import at.hannibal2.skyhanni.features.gui.customscoreboard.events.ScoreboardEventActiveTablist
import at.hannibal2.skyhanni.features.gui.customscoreboard.events.ScoreboardEventAnniversary
import at.hannibal2.skyhanni.features.gui.customscoreboard.events.ScoreboardEventBroodmother
Expand All @@ -20,7 +21,6 @@ import at.hannibal2.skyhanni.features.gui.customscoreboard.events.ScoreboardEven
import at.hannibal2.skyhanni.features.gui.customscoreboard.events.ScoreboardEventQueue
import at.hannibal2.skyhanni.features.gui.customscoreboard.events.ScoreboardEventRedstone
import at.hannibal2.skyhanni.features.gui.customscoreboard.events.ScoreboardEventRift
import at.hannibal2.skyhanni.features.gui.customscoreboard.events.ScoreboardEvent
import at.hannibal2.skyhanni.features.gui.customscoreboard.events.ScoreboardEventServerClose
import at.hannibal2.skyhanni.features.gui.customscoreboard.events.ScoreboardEventSpooky
import at.hannibal2.skyhanni.features.gui.customscoreboard.events.ScoreboardEventStartingSoonTablist
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ object ScoreboardPattern {
// Main scoreboard
private val mainSb = scoreboardGroup.group("main")

//TODO add regex tests
// TODO add regex tests
val motesPattern by mainSb.pattern(
"motes",
"(?:§.)*Motes: (?:§.)*(?<motes>[\\d,]+).*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import at.hannibal2.skyhanni.data.HypixelData
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.displayConfig
import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.informationFilteringConfig
import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboardUtils.formatNumber
import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboardUtils.getBitsLine
import at.hannibal2.skyhanni.utils.LorenzUtils.inAnyIsland

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ object ScoreboardElementCopper : ScoreboardElement() {
override fun showIsland() = GardenAPI.inGarden()
}

// click: warp barn?
// click: warp barn?
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import at.hannibal2.skyhanni.features.dungeon.DungeonAPI
object ScoreboardElementLobbyCode : ScoreboardElement() {
override fun getDisplay(): String? {
val lobbyCode = HypixelData.serverId ?: return null
val roomId = DungeonAPI.getRoomID()?.let { " §8$it" } ?: ""
val roomId = DungeonAPI.getRoomID()?.let { " §8$it" }.orEmpty()
return "§8$lobbyCode$roomId"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object ScoreboardElementPurse : ScoreboardElement() {
var purse = formatNumber(PurseAPI.currentPurse)

if (!displayConfig.hideCoinsDifference) {
purse += getPurseEarned() ?: ""
purse += getPurseEarned().orEmpty()
}

return when {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ object ScoreboardElementQuiver : ScoreboardElement() {
QuiverAPI.currentAmount.toLong(),
QuiverAPI.MAX_ARROW_AMOUNT.toLong(),
).getChatColor()
} else "") +
} else ""
) +
if (QuiverAPI.wearingSkeletonMasterChestplate) ""
else {
when (arrowConfig.arrowAmountDisplay) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import at.hannibal2.skyhanni.events.LorenzKeyPressEvent
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzToolTipEvent
import at.hannibal2.skyhanni.events.SkyHanniWarpEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.events.SkyHanniWarpEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.CollectionUtils.addString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ object EstimatedItemValueCalculator {

// todo use repo
val tieredEnchants = listOf("compact", "cultivating", "champion", "expertise", "hecatomb", "toxophilite")
@Suppress("PropertyWrapping")
val onlyTierOnePrices = listOf("ultimate_chimera", "ultimate_fatal_tempo", "smoldering", "ultimate_flash", "divine_gift")
val onlyTierFivePrices = listOf("ferocious_mana", "hardened_mana", "mana_vampire", "strong_mana")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ object HypixelCommands {
fun bank() {
send("bank")
}

fun pickupStash() {
send("pickupstash")
}
Expand Down
1 change: 0 additions & 1 deletion src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import at.hannibal2.skyhanni.data.hypixel.chat.event.SystemMessageEvent
import at.hannibal2.skyhanni.mixins.transformers.AccessorChatComponentText
import at.hannibal2.skyhanni.utils.GuiRenderUtils.darkenColor
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import at.hannibal2.skyhanni.utils.RegexUtils.findAll
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import net.minecraft.client.Minecraft
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ class TimeLimitedSet<T : Any>(
private val removalListener: (T, RemovalCause) -> Unit = { _, _ -> },
) : Iterable<T> {

private val cache = TimeLimitedCache<T, Unit>(expireAfterWrite) { key, _, cause -> key?.let { removalListener(it, cause) } }
private val cache = TimeLimitedCache<T, Unit>(expireAfterWrite) { key, _, cause ->
key?.let {
removalListener(it, cause)
}
}

fun add(element: T) {
cache[element] = Unit
Expand Down

0 comments on commit e7961e3

Please sign in to comment.