diff options
author | Walker Selby <git@walkerselby.com> | 2023-11-22 11:50:00 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-22 12:50:00 +0100 |
commit | 4ff0a7de8109b748cdaa707e9714478140095171 (patch) | |
tree | d0321aeb182c1ace326c8c851dbf9a7e8861ff62 /src/main/java/at/hannibal2/skyhanni/features/misc | |
parent | 5d1e9a07eabe3872c714b17b64b7a6e0a0073d73 (diff) | |
download | skyhanni-4ff0a7de8109b748cdaa707e9714478140095171.tar.gz skyhanni-4ff0a7de8109b748cdaa707e9714478140095171.tar.bz2 skyhanni-4ff0a7de8109b748cdaa707e9714478140095171.zip |
Internal Change: Reformat Code to match .editorconfig (#628)
Code cleanup done everywhere #628
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
12 files changed, 102 insertions, 36 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt index 1ddcb40e7..e05571b6a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt @@ -170,7 +170,7 @@ class CollectionTracker { val currentlyInInventory = countCurrentlyInInventory() val diff = currentlyInInventory - lastAmountInInventory if (diff != 0 && diff > 0) { - gainItems(diff) + gainItems(diff) } lastAmountInInventory = currentlyInInventory diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/MiscFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/MiscFeatures.kt index 0d164b477..3b52ee478 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/MiscFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MiscFeatures.kt @@ -11,7 +11,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent /** * I need these features in my dev env - */ + */ class MiscFeatures { @SubscribeEvent @@ -32,6 +32,7 @@ class MiscFeatures { EnumParticleTypes.EXPLOSION_HUGE, EnumParticleTypes.EXPLOSION_NORMAL, -> event.isCanceled = true + else -> {} } } @@ -50,4 +51,4 @@ class MiscFeatures { fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "mobs", "combat.mobs") } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt index f4ce726f4..80c3b870d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt @@ -58,6 +58,7 @@ class NonGodPotEffectDisplay { GREAT_SPOOK("§fGreat Spook I", inventoryItemName = "§fGreat Spook Potion"), ; } + // TODO USE SH-REPO private var patternEffectsCount = "§7You have §e(?<name>\\d+) §7non-god effects\\.".toPattern() private var totalEffectsCount = 0 diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PlayerChatSymbols.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PlayerChatSymbols.kt index c3d45ccee..2f47b3db1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PlayerChatSymbols.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PlayerChatSymbols.kt @@ -72,13 +72,16 @@ class PlayerChatSymbols { if (!component.text_skyhanni().contains(rankAndName)) return false val oldText = component.text_skyhanni() - component.setText_skyhanni(component.text_skyhanni().replace(oldText, getNewText(emblemText, oldText, rankAndName))) + component.setText_skyhanni( + component.text_skyhanni().replace(oldText, getNewText(emblemText, oldText, rankAndName)) + ) return true } - private fun getNewText(emblemText: String, oldText: String, rankAndName: String): String = when (config.symbolLocation) { - 0 -> oldText.replace(rankAndName, "$emblemText $rankAndName") - 1 -> oldText.replace(rankAndName, "$rankAndName $emblemText ") - else -> oldText - } -}
\ No newline at end of file + private fun getNewText(emblemText: String, oldText: String, rankAndName: String): String = + when (config.symbolLocation) { + 0 -> oldText.replace(rankAndName, "$emblemText $rankAndName") + 1 -> oldText.replace(rankAndName, "$rankAndName $emblemText ") + else -> oldText + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/SuperpairsClicksAlert.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/SuperpairsClicksAlert.kt index f4da6126b..6ca018c9f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/SuperpairsClicksAlert.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/SuperpairsClicksAlert.kt @@ -43,12 +43,12 @@ class SuperpairsClicksAlert { if ( // checks if we have succeeded in either minigame (event.inventoryName.contains("Chronomatron") - && ((event.inventoryItems[4]?.displayName?.removeColor() + && ((event.inventoryItems[4]?.displayName?.removeColor() ?.let { currentRoundRegex.find(it) } ?.groups?.get(1)?.value?.toInt() ?: -1) > roundsNeeded)) || (event.inventoryName.contains("Ultrasequencer") - && event.inventoryItems.entries + && event.inventoryItems.entries .filter { it.key < 45 } .any { it.value.stackSize > roundsNeeded }) ) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt index bcee7863f..4298edf21 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt @@ -32,7 +32,8 @@ class TimeFeatures { if (!LorenzUtils.inSkyBlock) return if (config.realTime) { - val currentTime = (if (config.realTimeFormatToggle) timeFormat12h else timeFormat24h).format(System.currentTimeMillis()) + val currentTime = + (if (config.realTimeFormatToggle) timeFormat12h else timeFormat24h).format(System.currentTimeMillis()) config.realTimePosition.renderString(currentTime, posLabel = "Real Time") } @@ -56,4 +57,4 @@ class TimeFeatures { event.move(2, "misc.timeConfigs.realTime", "gui.realTime") event.move(2, "misc.timeConfigs.realTimePos", "gui.realTimePosition") } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt index 3f7f537ed..a81205ce7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.kt @@ -13,6 +13,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent // heavily inspired by SBA code object TabListReader { private val config get() = SkyHanniMod.feature.misc.compactTabList + // TODO USE SH-REPO var hypixelAdvertisingString = "HYPIXEL.NET" private val godPotPattern = "You have a God Potion active! (?<timer>[\\w ]+)".toPattern() @@ -221,4 +222,4 @@ object TabListReader { } } } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt index e95132ff7..780ed54c7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt @@ -371,7 +371,9 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier<String>?) }), AFK({ - if (beenAfkFor.passedSince() > 5.minutes) "AFK for ${beenAfkFor.passedSince().format(maxUnits = 1, longName = true)}" + if (beenAfkFor.passedSince() > 5.minutes) "AFK for ${ + beenAfkFor.passedSince().format(maxUnits = 1, longName = true) + }" else AutoStatus.AFK.placeholderText }) ; diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt index 6127266d9..7586805df 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt @@ -232,7 +232,8 @@ object TrevorFeatures { location = LorenzVec(location.x, TrevorSolver.averageHeight, location.z) } if (TrevorSolver.mobLocation == CurrentMobArea.FOUND) { - val displayName = if (TrevorSolver.currentMob == null) "Mob Location" else TrevorSolver.currentMob!!.mobName + val displayName = + if (TrevorSolver.currentMob == null) "Mob Location" else TrevorSolver.currentMob!!.mobName location = TrevorSolver.mobCoordinates event.drawWaypointFilled(location.add(0, -2, 0), LorenzColor.GREEN.toColor(), true, true) event.drawDynamicText(location.add(0, 1, 0), displayName, 1.5) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorTracker.kt index f2e36db59..86f917d35 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorTracker.kt @@ -17,7 +17,8 @@ object TrevorTracker { private val config get() = SkyHanniMod.feature.misc.trevorTheTrapper // TODO USE SH-REPO - private val selfKillMobPattern = "§aYour mob died randomly, you are rewarded §r§5(?<pelts>.*) pelts§r§a.".toPattern() + private val selfKillMobPattern = + "§aYour mob died randomly, you are rewarded §r§5(?<pelts>.*) pelts§r§a.".toPattern() private val killMobPattern = "§aKilling the animal rewarded you §r§5(?<pelts>.*) pelts§r§a.".toPattern() private var display = emptyList<List<Any>>() @@ -78,7 +79,7 @@ object TrevorTracker { if (matcher.matches()) { val pelts = matcher.group("pelts").toInt() storage.peltsGained += pelts - storage.selfKillingAnimals += 1 + storage.selfKillingAnimals += 1 saveAndUpdate() } matcher = killMobPattern.matcher(event.message) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt index 9d68aebde..b3539c131 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt @@ -47,7 +47,7 @@ class GuiOptionEditorUpdateCheck(option: ProcessedOption) : GuiOptionEditor(opti val sameVersion = currentVersion.equals(nextVersion, true) TextRenderUtils.drawStringCenteredScaledMaxWidth( "${if (UpdateManager.updateState == UpdateManager.UpdateState.NONE) GREEN else RED}$currentVersion" + - if (nextVersion != null && !sameVersion) "➜ ${GREEN}${nextVersion}" else "", + if (nextVersion != null && !sameVersion) "➜ ${GREEN}${nextVersion}" else "", fr, widthRemaining / 4F, 10F, @@ -85,4 +85,4 @@ class GuiOptionEditorUpdateCheck(option: ProcessedOption) : GuiOptionEditor(opti override fun fulfillsSearch(word: String): Boolean { return super.fulfillsSearch(word) || word in "download" || word in "update" } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt index 49c22b26d..b6a8feca2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt @@ -137,7 +137,11 @@ open class VisualWordGui : GuiScreen() { inBox = true } - drawUnmodifiedString("${index + 1}.", (guiLeft + 5) * inverseScale, (adjustedY + 10 + 30 * index) * inverseScale) + drawUnmodifiedString( + "${index + 1}.", + (guiLeft + 5) * inverseScale, + (adjustedY + 10 + 30 * index) * inverseScale + ) val top = adjustedY + 30 * index + 7 if (isPointInLastClicked(guiLeft + 335, top, 16, 16)) { @@ -167,7 +171,14 @@ open class VisualWordGui : GuiScreen() { } if (inBox) { - GuiRenderUtils.drawScaledRec(guiLeft, adjustedY + 30 * index, guiLeft + sizeX, adjustedY + 30 * index + 30, colorB, inverseScale) + GuiRenderUtils.drawScaledRec( + guiLeft, + adjustedY + 30 * index, + guiLeft + sizeX, + adjustedY + 30 * index + 30, + colorB, + inverseScale + ) } val statusBlock = if (phrase.enabled) { @@ -190,11 +201,27 @@ open class VisualWordGui : GuiScreen() { GlStateManager.scale(scale, scale, 1f) if (inBox) { - drawUnmodifiedString(phrase.phrase, (guiLeft + 15) * inverseScale, (adjustedY + 5 + 30 * index) * inverseScale) - drawUnmodifiedString(phrase.replacement, (guiLeft + 15) * inverseScale, (adjustedY + 15 + 30 * index) * inverseScale) + drawUnmodifiedString( + phrase.phrase, + (guiLeft + 15) * inverseScale, + (adjustedY + 5 + 30 * index) * inverseScale + ) + drawUnmodifiedString( + phrase.replacement, + (guiLeft + 15) * inverseScale, + (adjustedY + 15 + 30 * index) * inverseScale + ) } else { - drawUnmodifiedString(phrase.phrase.convertToFormatted(), (guiLeft + 15) * inverseScale, (adjustedY + 5 + 30 * index) * inverseScale) - drawUnmodifiedString(phrase.replacement.convertToFormatted(), (guiLeft + 15) * inverseScale, (adjustedY + 15 + 30 * index) * inverseScale) + drawUnmodifiedString( + phrase.phrase.convertToFormatted(), + (guiLeft + 15) * inverseScale, + (adjustedY + 5 + 30 * index) * inverseScale + ) + drawUnmodifiedString( + phrase.replacement.convertToFormatted(), + (guiLeft + 15) * inverseScale, + (adjustedY + 15 + 30 * index) * inverseScale + ) } } @@ -256,17 +283,45 @@ open class VisualWordGui : GuiScreen() { GlStateManager.scale(0.75f, 0.75f, 1f) - drawUnmodifiedString("§bThe top line of each section", (guiLeft + 10) * inverseScale, (guiTop + 12) * inverseScale) - drawUnmodifiedString("§bis the preview of the bottom text", (guiLeft + 10) * inverseScale, (guiTop + 22) * inverseScale) - - drawUnmodifiedString("§bTo get the Minecraft", (guiLeft + 220) * inverseScale, (guiTop + 12) * inverseScale) - drawUnmodifiedString("§b formatting character use \"&&\"", (guiLeft + 220) * inverseScale, (guiTop + 22) * inverseScale) - - drawUnmodifiedString(currentPhrase.phrase.convertToFormatted(), (guiLeft + 30) * inverseScale, (guiTop + 40) * inverseScale) + drawUnmodifiedString( + "§bThe top line of each section", + (guiLeft + 10) * inverseScale, + (guiTop + 12) * inverseScale + ) + drawUnmodifiedString( + "§bis the preview of the bottom text", + (guiLeft + 10) * inverseScale, + (guiTop + 22) * inverseScale + ) + + drawUnmodifiedString( + "§bTo get the Minecraft", + (guiLeft + 220) * inverseScale, + (guiTop + 12) * inverseScale + ) + drawUnmodifiedString( + "§b formatting character use \"&&\"", + (guiLeft + 220) * inverseScale, + (guiTop + 22) * inverseScale + ) + + drawUnmodifiedString( + currentPhrase.phrase.convertToFormatted(), + (guiLeft + 30) * inverseScale, + (guiTop + 40) * inverseScale + ) drawUnmodifiedString(currentPhrase.phrase, (guiLeft + 30) * inverseScale, (guiTop + 55) * inverseScale) - drawUnmodifiedString(currentPhrase.replacement.convertToFormatted(), (guiLeft + 30) * inverseScale, (guiTop + 95) * inverseScale) - drawUnmodifiedString(currentPhrase.replacement, (guiLeft + 30) * inverseScale, (guiTop + 110) * inverseScale) + drawUnmodifiedString( + currentPhrase.replacement.convertToFormatted(), + (guiLeft + 30) * inverseScale, + (guiTop + 95) * inverseScale + ) + drawUnmodifiedString( + currentPhrase.replacement, + (guiLeft + 30) * inverseScale, + (guiTop + 110) * inverseScale + ) GlStateManager.scale(inverseScale, inverseScale, 1f) } |