From 6da1f6daeea8383de0f363fcb007cc9df15afd45 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Thu, 7 Mar 2024 08:46:22 +1100 Subject: Backend: Reformat code in all files in src directory (#1109) --- .../features/chroma/ChromaShaderManager.kt | 1 + .../features/combat/ghostcounter/GhostCounter.kt | 6 +- .../features/cosmetics/CosmeticFollowingLine.kt | 2 +- .../features/event/diana/HighlightInquisitors.kt | 5 +- .../event/diana/MythologicalCreatureTracker.kt | 5 +- .../lobby/waypoints/christmas/PresentWaypoints.kt | 2 +- .../features/fishing/trophy/GeyserFishing.kt | 10 +++- .../features/garden/FarmingFortuneDisplay.kt | 1 + .../features/garden/GardenNextJacobContest.kt | 6 +- .../skyhanni/features/garden/GardenOptimalSpeed.kt | 2 +- .../features/garden/farming/CropMoneyDisplay.kt | 1 - .../garden/farming/FarmingWeightDisplay.kt | 11 +++- .../inventory/ItemDisplayOverlayFeatures.kt | 8 +-- .../skyhanni/features/inventory/MaxPurseItems.kt | 2 +- .../features/inventory/QuiverNotification.kt | 1 + .../mining/eventtracker/MiningEventTracker.kt | 2 +- .../features/minion/InfernoMinionFeatures.kt | 3 +- .../hannibal2/skyhanni/features/minion/MinionXp.kt | 4 +- .../skyhanni/features/misc/BetterWikiFromMenus.kt | 3 +- .../skyhanni/features/misc/CustomTextBox.kt | 3 +- .../skyhanni/features/misc/MarkedPlayerManager.kt | 3 +- .../skyhanni/features/misc/QuickModMenuSwitch.kt | 2 +- .../features/misc/items/EstimatedItemValue.kt | 5 +- .../nether/ashfang/AshfangFreezeCooldown.kt | 2 +- .../features/skillprogress/SkillProgress.kt | 66 ++++++++++++++++------ .../features/skillprogress/SkillTooltip.kt | 6 +- .../skyhanni/features/skillprogress/SkillUtil.kt | 2 +- .../skyhanni/features/slayer/SlayerQuestWarning.kt | 2 +- 28 files changed, 112 insertions(+), 54 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features') diff --git a/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShaderManager.kt b/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShaderManager.kt index 60b748d33..db6e06d25 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShaderManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShaderManager.kt @@ -50,6 +50,7 @@ enum class ChromaType(val shaderName: String) { * See [StandardChromaShader] */ STANDARD("standard_chroma"), + /** * See [TexturedChromaShader] */ diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt index c4eb1f074..dd226d800 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt @@ -182,7 +182,7 @@ object GhostCounter { val bestiary = if (config.showMax) { when (nextLevel) { 26 -> bestiaryFormatting.maxed.replace("%currentKill%", currentKill.addSeparators()) - in 1 .. 25 -> { + in 1..25 -> { val sum = bestiaryData.filterKeys { it <= nextLevel - 1 }.values.sum() val cKill = sum + currentKill @@ -195,7 +195,7 @@ object GhostCounter { } else { when (nextLevel) { 26 -> bestiaryFormatting.maxed - in 1 .. 25 -> bestiaryFormatting.progress + in 1..25 -> bestiaryFormatting.progress else -> bestiaryFormatting.openMenu } } @@ -301,7 +301,7 @@ object GhostCounter { val res = current.formatNumber().toString() gain = (res.toLong() - lastXp.toLong()).toDouble().roundToInt() num = (gain.toDouble() / gained) - if (gained in 150.0 .. 450.0 && lastXp != "0" && num >= 0) { + if (gained in 150.0..450.0 && lastXp != "0" && num >= 0) { KILLS.add(num) KILLS.add(num, true) Option.GHOSTSINCESORROW.add(num) diff --git a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt index 1515e9a11..8f6dd1430 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt @@ -1,8 +1,8 @@ package at.hannibal2.skyhanni.features.cosmetics import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt index 534dc4c91..51a3def55 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/HighlightInquisitors.kt @@ -21,7 +21,10 @@ class HighlightInquisitors { val entity = event.entity if (entity is EntityPlayer && entity.name == "Minos Inquisitor") { - RenderLivingEntityHelper.setEntityColor(entity, LorenzColor.AQUA.toColor().withAlpha(127)) { config.highlightInquisitors } + RenderLivingEntityHelper.setEntityColor( + entity, + LorenzColor.AQUA.toColor().withAlpha(127) + ) { config.highlightInquisitors } RenderLivingEntityHelper.setNoHurtTime(entity) { config.highlightInquisitors } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt index 001a96c4a..bfb849ff1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt @@ -49,8 +49,9 @@ object MythologicalCreatureTracker { ".* §r§eYou dug out a §r§2Minos Inquisitor§r§e!" ) - private val tracker = SkyHanniTracker("Mythological Creature Tracker", { Data() }, { it.diana.mythologicalMobTracker }) - { drawDisplay(it) } + private val tracker = + SkyHanniTracker("Mythological Creature Tracker", { Data() }, { it.diana.mythologicalMobTracker }) + { drawDisplay(it) } class Data : TrackerData() { diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/christmas/PresentWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/christmas/PresentWaypoints.kt index 257e69f3d..97da18d3c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/christmas/PresentWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/christmas/PresentWaypoints.kt @@ -32,7 +32,7 @@ class PresentWaypoints { private val presentEntranceSet get() = presentEntranceLocations[HypixelData.lobbyType] private val patternGroup = RepoPattern.group("event.lobby.waypoint.presents") - private val presentAlreadyFoundPattern by patternGroup.pattern( + private val presentAlreadyFoundPattern by patternGroup.pattern( "foundalready", "§cYou have already found this present!" ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GeyserFishing.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GeyserFishing.kt index fb0b591cd..deb699327 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GeyserFishing.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/GeyserFishing.kt @@ -28,7 +28,12 @@ class GeyserFishing { @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) fun onReceiveParticle(event: ReceiveParticleEvent) { if (!shouldProcessParticles()) return - if (event.type != EnumParticleTypes.CLOUD || event.count != 15 || event.speed != 0.05f || event.offset != LorenzVec(0.1f, 0.6f, 0.1f)) return + if (event.type != EnumParticleTypes.CLOUD || event.count != 15 || event.speed != 0.05f || event.offset != LorenzVec( + 0.1f, + 0.6f, + 0.1f + ) + ) return geyser = event.location val potentialGeyser = geyser ?: return @@ -71,5 +76,6 @@ class GeyserFishing { } } - private fun shouldProcessParticles() = IslandType.CRIMSON_ISLE.isInIsland() && LorenzUtils.skyBlockArea == "Blazing Volcano" && (config.hideParticles || config.drawBox) + private fun shouldProcessParticles() = + IslandType.CRIMSON_ISLE.isInIsland() && LorenzUtils.skyBlockArea == "Blazing Volcano" && (config.hideParticles || config.drawBox) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt index bbecb3d55..d6c4ab6b6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt @@ -64,6 +64,7 @@ object FarmingFortuneDisplay { "lotusability", "§7Piece Bonus: §6+(?.*)☘" ) + // todo make pattern work on Melon and Cropie armor private val armorAbilityFortunePattern by patternGroup.pattern( "armorabilityfortune", diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt index b114d5ab4..76e1395ab 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt @@ -613,8 +613,10 @@ object GardenNextJacobContest { if (result) { ChatUtils.chat("Successfully submitted this years upcoming contests, thank you for helping everyone out!") } else { - ErrorManager.logErrorStateWithData("Something went wrong submitting upcoming contests!", - "submitContestsToElite not sucessful") + ErrorManager.logErrorStateWithData( + "Something went wrong submitting upcoming contests!", + "submitContestsToElite not sucessful" + ) } } catch (e: Exception) { ErrorManager.logErrorWithData( diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt index 3f1021bcb..586906554 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt @@ -14,8 +14,8 @@ import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.renderables.Renderable -import io.github.moulberry.moulconfig.observer.Property import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern +import io.github.moulberry.moulconfig.observer.Property import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiEditSign import net.minecraftforge.client.event.GuiOpenEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt index f9a0f558e..ba9638711 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt @@ -11,7 +11,6 @@ import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.CropType.Companion.getByNameOrNull import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.GardenNextJacobContest -import at.hannibal2.skyhanni.features.garden.composter.ComposterOverlay import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.isSpeedDataEmpty import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.Companion.getBazaarData diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt index 6baa0970f..5147df33b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt @@ -86,7 +86,11 @@ class FarmingWeightDisplay { event.move(3, "garden.eliteFarmingWeightPos", "garden.eliteFarmingWeights.pos") event.move(3, "garden.eliteFarmingWeightLeaderboard", "garden.eliteFarmingWeights.leaderboard") event.move(3, "garden.eliteFarmingWeightOvertakeETA", "garden.eliteFarmingWeights.overtakeETA") - event.move(3, "garden.eliteFarmingWeightOffScreenDropMessage", "garden.eliteFarmingWeights.offScreenDropMessage") + event.move( + 3, + "garden.eliteFarmingWeightOffScreenDropMessage", + "garden.eliteFarmingWeights.offScreenDropMessage" + ) event.move(3, "garden.eliteFarmingWeightOvertakeETAAlways", "garden.eliteFarmingWeights.overtakeETAAlways") event.move(3, "garden.eliteFarmingWeightETAGoalRank", "garden.eliteFarmingWeights.ETAGoalRank") event.move(3, "garden.eliteFarmingWeightIgnoreLow", "garden.eliteFarmingWeights.ignoreLow") @@ -538,7 +542,10 @@ class FarmingWeightDisplay { val apiResponse = APIUtil.getJSONResponse(url) try { - val apiData = ConfigManager.gson.fromJson>(apiResponse, object : TypeToken>() {}.type) + val apiData = ConfigManager.gson.fromJson>( + apiResponse, + object : TypeToken>() {}.type + ) for (crop in apiData) { val cropType = CropType.getByName(crop.key) factorPerCrop[cropType] = crop.value diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt index 35f0c6f4a..ab7154e44 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -212,9 +212,9 @@ object ItemDisplayOverlayFeatures { item.name?.let { dungeonPotionPattern.matchMatcher(it.removeColor()) { return when (val level = group("level").romanToDecimal()) { - in 1 .. 2 -> "§f$level" - in 3 .. 4 -> "§a$level" - in 5 .. 6 -> "§9$level" + in 1..2 -> "§f$level" + in 3..4 -> "§a$level" + in 5..6 -> "§9$level" else -> "§5$level" } } @@ -286,4 +286,4 @@ object ItemDisplayOverlayFeatures { } fun ItemNumberEntry.isSelected() = config.itemNumberAsStackSize.contains(this) -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/MaxPurseItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/MaxPurseItems.kt index 72296ff4b..d835fc5a8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/MaxPurseItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/MaxPurseItems.kt @@ -34,7 +34,7 @@ class MaxPurseItems { "createinstant", "§aBuy Instantly" ) - + private var buyOrderPrice: Double? = null private var instantBuyPrice: Double? = null diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/QuiverNotification.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/QuiverNotification.kt index d80ef783c..3bcd6e43b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/QuiverNotification.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/QuiverNotification.kt @@ -14,6 +14,7 @@ object QuiverNotification { "inventory.quiver.chat.low", "§cYou only have (?.*) arrows left in your Quiver!" ) + @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { if (!SkyHanniMod.configManager.features.inventory.quiverAlert) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt index 86c51f365..010c62615 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt @@ -137,7 +137,7 @@ class MiningEventTracker { } private fun isEnabled() = (IslandType.DWARVEN_MINES.isInIsland() || IslandType.CRYSTAL_HOLLOWS.isInIsland()) - && config.sendData + && config.sendData // && config.enabled private fun sendData(json: String) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/InfernoMinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/InfernoMinionFeatures.kt index 37593552d..c07c351d2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/InfernoMinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/InfernoMinionFeatures.kt @@ -46,7 +46,8 @@ class InfernoMinionFeatures { if (!config.infernoFuelBlocker) return if (!inInventory) return - val containsFuel = NEUInternalName.fromItemNameOrNull(event.container.getSlot(19).stack.name.toString()) in fuelItemIds + val containsFuel = + NEUInternalName.fromItemNameOrNull(event.container.getSlot(19).stack.name.toString()) in fuelItemIds if (!containsFuel) return if (event.slot?.slotNumber == 19 || event.slot?.slotNumber == 53) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt index 22969de1c..086f4816d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt @@ -47,7 +47,7 @@ class MinionXp { private fun toPrimitiveItemStack(itemStack: ItemStack) = PrimitiveItemStack(itemStack.getInternalName(), itemStack.stackSize) - + @SubscribeEvent fun onMinionOpen(event: MinionOpenEvent) { if (!config.xpDisplay) return @@ -92,7 +92,7 @@ class MinionXp { private fun handleItems(inventoryItems: Map, isMinion: Boolean): EnumMap { val xpTotal = EnumMap(SkillType::class.java) inventoryItems.filter { - it.value.getLore().isNotEmpty() && (!isMinion || it.key in listOf(21 .. 26, 30 .. 35, 39 .. 44).flatten()) + it.value.getLore().isNotEmpty() && (!isMinion || it.key in listOf(21..26, 30..35, 39..44).flatten()) }.forEach { (_, itemStack) -> val item = toPrimitiveItemStack(itemStack) val name = item.internalName diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/BetterWikiFromMenus.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/BetterWikiFromMenus.kt index a0ead6b7c..8c931dfab 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/BetterWikiFromMenus.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/BetterWikiFromMenus.kt @@ -35,7 +35,8 @@ class BetterWikiFromMenus { val isWiki = event.slotId == 11 && itemClickedName.contains("Wiki Command") val isWikithis = event.slotId == 15 && itemClickedName.contains("Wikithis Command") val inBiblioInventory = chestName == "SkyBlock Wiki" && (isWiki || isWikithis) - val inSBGuideInventory = (itemClickedStack.getLore().let { it.any { line -> line == "§7§eClick to view on the SkyBlock Wiki!" } }) + val inSBGuideInventory = + (itemClickedStack.getLore().let { it.any { line -> line == "§7§eClick to view on the SkyBlock Wiki!" } }) if (inBiblioInventory) { if (isWiki) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt index cfecac7e0..c5dde5ffb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt @@ -42,7 +42,8 @@ class CustomTextBox { config.position.renderStrings(display, posLabel = "Custom Text Box") } - private fun isEnabled() = config.enabled && (LorenzUtils.inSkyBlock || OutsideSbFeature.CUSTOM_TEXT_BOX.isSelected()) + private fun isEnabled() = + config.enabled && (LorenzUtils.inSkyBlock || OutsideSbFeature.CUSTOM_TEXT_BOX.isSelected()) @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { 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 8d647c9d0..b8a57856c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt @@ -106,7 +106,8 @@ class MarkedPlayerManager { } } - private fun isEnabled() = config.highlightInWorld && (LorenzUtils.inSkyBlock || OutsideSbFeature.MARKED_PLAYERS.isSelected()) + private fun isEnabled() = + config.highlightInWorld && (LorenzUtils.inSkyBlock || OutsideSbFeature.MARKED_PLAYERS.isSelected()) @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt index a0ce295b5..8a4d3eebe 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt @@ -2,8 +2,8 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator -import at.hannibal2.skyhanni.data.jsonobjects.repo.ModGuiSwitcherJson import at.hannibal2.skyhanni.config.enums.OutsideSbFeature +import at.hannibal2.skyhanni.data.jsonobjects.repo.ModGuiSwitcherJson import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.test.command.ErrorManager diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt index f350991ae..e5da89e83 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt @@ -54,7 +54,10 @@ object EstimatedItemValue { ErrorManager.skyHanniError("Gemstone Slot Unlock Costs failed to load from neu repo!") } - gemstoneUnlockCosts = ConfigManager.gson.fromJson(data, object : TypeToken>>>() {}.type) + gemstoneUnlockCosts = ConfigManager.gson.fromJson( + data, + object : TypeToken>>>() {}.type + ) } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt index cb012f728..87ff3b5f0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt @@ -10,8 +10,8 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher -import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import at.hannibal2.skyhanni.utils.TimeUtils.format +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds diff --git a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt index 393889467..1ec2a08d5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt @@ -95,8 +95,16 @@ object SkillProgress { SkillProgressConfig.TextAlignment.RIGHT, -> { config.displayPosition.renderRenderables( - listOf(Renderable.fixedSizeLine(horizontalContainer(display, horizontalAlign = textAlignment.alignment), maxWidth)), - posLabel = "Skill Progress") + listOf( + Renderable.fixedSizeLine( + horizontalContainer( + display, + horizontalAlign = textAlignment.alignment + ), maxWidth + ) + ), + posLabel = "Skill Progress" + ) } else -> {} @@ -111,7 +119,8 @@ object SkillProgress { percent = factor.toDouble(), startColor = Color(SpecialColour.specialToChromaRGB(barConfig.barStartColor)), texture = barConfig.texturedBar.usedTexture.get(), - useChroma = barConfig.useChroma.get()) + useChroma = barConfig.useChroma.get() + ) } else { maxWidth = barConfig.regularBar.width @@ -122,7 +131,8 @@ object SkillProgress { endColor = Color(SpecialColour.specialToChromaRGB(barConfig.barStartColor)), width = maxWidth, height = barConfig.regularBar.height, - useChroma = barConfig.useChroma.get()) + useChroma = barConfig.useChroma.get() + ) } config.barPosition.renderRenderables(listOf(progress), posLabel = "Skill Progress Bar") @@ -255,22 +265,28 @@ object SkillProgress { for (skill in sortedMap) { val skillInfo = skillMap[skill] ?: SkillAPI.SkillInfo(level = -1, overflowLevel = -1) val lockedLevels = skillInfo.overflowCurrentXp > skillInfo.overflowCurrentXpMax - val useCustomGoalLevel = skillInfo.customGoalLevel != 0 && skillInfo.customGoalLevel > skillInfo.overflowLevel && customGoalConfig.enableInAllDisplay + val useCustomGoalLevel = + skillInfo.customGoalLevel != 0 && skillInfo.customGoalLevel > skillInfo.overflowLevel && customGoalConfig.enableInAllDisplay val targetLevel = skillInfo.customGoalLevel var xp = skillInfo.overflowTotalXp - if (targetLevel in 50 .. 60 && skillInfo.overflowLevel >= 50) xp += SkillUtil.xpRequiredForLevel(50.0) + if (targetLevel in 50..60 && skillInfo.overflowLevel >= 50) xp += SkillUtil.xpRequiredForLevel(50.0) else if (targetLevel > 60 && skillInfo.overflowLevel >= 60) xp += SkillUtil.xpRequiredForLevel(60.0) var have = skillInfo.overflowTotalXp val need = SkillUtil.xpRequiredForLevel(targetLevel.toDouble()) - if (targetLevel in 51 .. 59) have += SkillUtil.xpRequiredForLevel(50.0) + if (targetLevel in 51..59) have += SkillUtil.xpRequiredForLevel(50.0) else if (targetLevel > 60) have += SkillUtil.xpRequiredForLevel(60.0) val (level, currentXp, currentXpMax, totalXp) = if (useCustomGoalLevel) Quad(skillInfo.overflowLevel, have, need, xp) else if (config.overflowConfig.enableInAllDisplay.get() && !lockedLevels) - Quad(skillInfo.overflowLevel, skillInfo.overflowCurrentXp, skillInfo.overflowCurrentXpMax, skillInfo.overflowTotalXp) + Quad( + skillInfo.overflowLevel, + skillInfo.overflowCurrentXp, + skillInfo.overflowCurrentXpMax, + skillInfo.overflowTotalXp + ) else Quad(skillInfo.level, skillInfo.currentXp, skillInfo.currentXpMax, skillInfo.totalXp) @@ -308,9 +324,11 @@ object SkillProgress { val xpInfo = skillXPInfoMap[activeSkill] ?: return@buildList val skillInfoLast = oldSkillInfoMap[activeSkill] ?: return@buildList oldSkillInfoMap[activeSkill] = skillInfo - val level = if (config.overflowConfig.enableInEtaDisplay.get() || config.customGoalConfig.enableInETADisplay) skillInfo.overflowLevel else skillInfo.level + val level = + if (config.overflowConfig.enableInEtaDisplay.get() || config.customGoalConfig.enableInETADisplay) skillInfo.overflowLevel else skillInfo.level - val useCustomGoalLevel = skillInfo.customGoalLevel != 0 && skillInfo.customGoalLevel > skillInfo.overflowLevel && customGoalConfig.enableInETADisplay + val useCustomGoalLevel = + skillInfo.customGoalLevel != 0 && skillInfo.customGoalLevel > skillInfo.overflowLevel && customGoalConfig.enableInETADisplay var targetLevel = if (useCustomGoalLevel) skillInfo.customGoalLevel else level + 1 if (targetLevel <= level || targetLevel > 400) targetLevel = (level + 1) @@ -324,7 +342,8 @@ object SkillProgress { if (!useCustomGoalLevel && have < need) { if (skillInfo.overflowCurrentXpMax == skillInfoLast.overflowCurrentXpMax) { - remaining = interpolate(remaining.toFloat(), (need - have).toFloat(), lastGainUpdate.toMillis()).toLong() + remaining = + interpolate(remaining.toFloat(), (need - have).toFloat(), lastGainUpdate.toMillis()).toLong() } } @@ -342,22 +361,33 @@ object SkillProgress { } else { val duration = ((remaining) * 1000 * 60 * 60 / xpInterp.toLong()).milliseconds val format = duration.format(TimeUnit.DAY) - add(Renderable.string("§7In §b$format " + - if (xpInfo.isActive) "" else "§c(PAUSED)")) + add( + Renderable.string( + "§7In §b$format " + + if (xpInfo.isActive) "" else "§c(PAUSED)" + ) + ) } if (xpInfo.xpGainLast == xpInfo.xpGainHour && xpInfo.xpGainHour <= 0) { add(Renderable.string("§7XP/h: §cN/A")) } else { xpInterp = interpolate(xpInfo.xpGainHour, xpInfo.xpGainLast, lastGainUpdate.toMillis()) - add(Renderable.string("§7XP/h: §e${xpInterp.toLong().addSeparators()} " + - if (xpInfo.isActive) "" else "§c(PAUSED)")) + add( + Renderable.string( + "§7XP/h: §e${xpInterp.toLong().addSeparators()} " + + if (xpInfo.isActive) "" else "§c(PAUSED)" + ) + ) } val session = xpInfo.timeActive.seconds.format(TimeUnit.HOUR) - add(Renderable.clickAndHover("§7Session: §e$session ${if (xpInfo.sessionTimerActive) "" else "§c(PAUSED)"}", - listOf("§eClick to reset!")) { + add( + Renderable.clickAndHover( + "§7Session: §e$session ${if (xpInfo.sessionTimerActive) "" else "§c(PAUSED)"}", + listOf("§eClick to reset!") + ) { xpInfo.sessionTimerActive = false xpInfo.timeActive = 0L chat("Timer for §b${activeSkill.displayName} §ehas been reset!") @@ -378,7 +408,7 @@ object SkillProgress { } var have = skill.overflowTotalXp val need = SkillUtil.xpRequiredForLevel(targetLevel.toDouble()) - if (targetLevel in 51 .. 59) have += SkillUtil.xpRequiredForLevel(50.0) + if (targetLevel in 51..59) have += SkillUtil.xpRequiredForLevel(50.0) else if (targetLevel > 60) have += SkillUtil.xpRequiredForLevel(60.0) diff --git a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillTooltip.kt b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillTooltip.kt index 4945a2c55..d9aba8d20 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillTooltip.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillTooltip.kt @@ -66,9 +66,9 @@ class SkillTooltip { val xpFor50 = SkillUtil.xpRequiredForLevel(50.0) val xpFor60 = SkillUtil.xpRequiredForLevel(60.0) - have += if (skillInfo.overflowLevel >= 60 && skill in excludedSkills || skillInfo.overflowLevel in 50 .. 59) xpFor50 - else if (skillInfo.overflowLevel >= 60 && skill !in excludedSkills) xpFor60 - else 0 + have += if (skillInfo.overflowLevel >= 60 && skill in excludedSkills || skillInfo.overflowLevel in 50..59) xpFor50 + else if (skillInfo.overflowLevel >= 60 && skill !in excludedSkills) xpFor60 + else 0 val progress = have.toDouble() / need val progressBar = StringUtils.progressBar(progress) diff --git a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillUtil.kt b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillUtil.kt index 54ea4bdc9..127f9459d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillUtil.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillUtil.kt @@ -90,7 +90,7 @@ object SkillUtil { var xpForCurr = 7000000 + slope var totalXpRequired = 0L - for (i in 61 .. level) { + for (i in 61..level) { totalXpRequired += xpForCurr xpForCurr += slope if (i % 10 == 0) slope *= 2 diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt index 618e238bc..331d3f111 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt @@ -21,7 +21,7 @@ class SlayerQuestWarning { private val config get() = SkyHanniMod.feature.slayer - private val talkToMaddoxPattern by RepoPattern.pattern( + private val talkToMaddoxPattern by RepoPattern.pattern( "slayer.questwarning.talkto", " {3}§r§5§l» §r§7Talk to Maddox to claim your .+ Slayer XP!" ) -- cgit