From 31344fc364cde2cef243a49f1e7d4c4fbb390699 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 13 Jun 2024 21:50:16 +0200 Subject: formatting --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 8 +++--- .../at/hannibal2/skyhanni/data/GuiEditManager.kt | 4 +-- .../java/at/hannibal2/skyhanni/data/HypixelData.kt | 31 +++++++++++----------- .../at/hannibal2/skyhanni/data/ScoreboardData.kt | 2 -- .../damageindicator/DamageIndicatorManager.kt | 16 +++++------ .../skyhanni/test/SkyHanniDebugsAndTests.kt | 18 +++++++------ 6 files changed, 40 insertions(+), 39 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 28a8aa318..191b56c2a 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -69,9 +69,9 @@ class SkyHanniMod { configManager = ConfigManager() configManager.firstLoad() initLogging() - Runtime.getRuntime().addShutdownHook(Thread { - configManager.saveConfig(ConfigFileType.FEATURES, "shutdown-hook") - }) + Runtime.getRuntime().addShutdownHook( + Thread { configManager.saveConfig(ConfigFileType.FEATURES, "shutdown-hook") }, + ) repo = RepoManager(ConfigManager.configDirectory) loadModule(repo) try { @@ -130,7 +130,7 @@ class SkyHanniMod { val modules: MutableList = ArrayList() private val globalJob: Job = Job(null) val coroutineScope = CoroutineScope( - CoroutineName("SkyHanni") + SupervisorJob(globalJob) + CoroutineName("SkyHanni") + SupervisorJob(globalJob), ) var screenToOpen: GuiScreen? = null private var screenTicks = 0 diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt index a7e09b3f0..0f53a3e0c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt @@ -95,14 +95,14 @@ object GuiEditManager { SkyHanniMod.screenToOpen = GuiPositionEditor( currentPositions.values().toList(), 2, - Minecraft.getMinecraft().currentScreen as? GuiContainer + Minecraft.getMinecraft().currentScreen as? GuiContainer, ) if (hotkeyReminder && lastHotkeyReminded.passedSince() > 30.minutes) { lastHotkeyReminded = SimpleTimeMark.now() ChatUtils.chat( "§eTo edit hidden GUI elements:\n" + " §7- §e1. Set a key in /sh edit.\n" + - " §7- §e2. Click that key while the GUI element is visible." + " §7- §e2. Click that key while the GUI element is visible.", ) } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index 8ade8f55e..94dc84efc 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -40,6 +40,7 @@ import kotlin.time.Duration.Companion.seconds object HypixelData { private val patternGroup = RepoPattern.group("data.hypixeldata") + // TODO add regex tests private val serverNameConnectionPattern by patternGroup.pattern( "servername.connection", @@ -134,15 +135,15 @@ object HypixelData { var skyBlockArea: String? = null var skyBlockAreaWithSymbol: String? = null - // Data from locraw - var locrawData: JsonObject? = null + // Data from locraw + var locrawData: JsonObject? = null private var locraw: MutableMap = listOf( "server", - "gametype", - "lobbyname", - "lobbytype", - "mode", - "map", + "gametype", + "lobbyname", + "lobbytype", + "mode", + "map", ).associateWith { "" }.toMutableMap() val server get() = locraw["server"] ?: "" @@ -169,14 +170,14 @@ object HypixelData { return } - ErrorManager.logErrorWithData( - Exception("NoServerId"), - "Could not find server id", - "islandType" to LorenzUtils.skyBlockIsland, - "tablist" to TabListData.getTabList(), - "scoreboard" to ScoreboardData.sidebarLinesFormatted, - ) - } + ErrorManager.logErrorWithData( + Exception("NoServerId"), + "Could not find server id", + "islandType" to LorenzUtils.skyBlockIsland, + "tablist" to TabListData.getTabList(), + "scoreboard" to ScoreboardData.sidebarLinesFormatted, + ) + } fun getPlayersOnCurrentServer(): Int { var amount = 0 diff --git a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt index 31499adb1..72abf6bab 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt @@ -28,8 +28,6 @@ object ScoreboardData { private val minecraftColorCodesPattern = "(?i)[0-9a-fkmolnr]".toPattern() - - fun formatLines(rawList: List): List { val list = mutableListOf() for (line in rawList) { 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 d41431726..a3054af48 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 @@ -207,7 +207,7 @@ object DamageIndicatorManager { data.nameAbove, sizeNameAbove, -18f, - smallestDistanceVew = smallestDistanceVew + smallestDistanceVew = smallestDistanceVew, ) } @@ -245,7 +245,7 @@ object DamageIndicatorManager { finalResult, sizeFinalResults, diff, - smallestDistanceVew = smallestDistanceVew + smallestDistanceVew = smallestDistanceVew, ) diff += 9f } @@ -264,7 +264,7 @@ object DamageIndicatorManager { finalResult, sizeFinalResults, diff, - smallestDistanceVew = smallestDistanceVew + smallestDistanceVew = smallestDistanceVew, ) diff += 9f } @@ -303,7 +303,7 @@ object DamageIndicatorManager { if (now > damageCounter.firstTick + 1_000) { damageCounter.oldDamages.add( - 0, OldDamage(now, damageCounter.currentDamage, damageCounter.currentHealing) + 0, OldDamage(now, damageCounter.currentDamage, damageCounter.currentHealing), ) damageCounter.firstTick = 0L damageCounter.currentDamage = 0 @@ -440,7 +440,7 @@ object DamageIndicatorManager { entity as EntityMagmaCube, entityData, health.toInt(), - maxHealth.toInt() + maxHealth.toInt(), ) BossType.SLAYER_ZOMBIE_5 -> { @@ -529,7 +529,7 @@ object DamageIndicatorManager { } return NumberUtil.percentageColor( - calcHealth.toLong(), calcMaxHealth.toLong() + calcHealth.toLong(), calcMaxHealth.toLong(), ).getChatColor() + NumberUtil.format(calcHealth) } @@ -650,7 +650,7 @@ object DamageIndicatorManager { else -> return null } var result = NumberUtil.percentageColor( - calcHealth.toLong(), calcMaxHealth.toLong() + calcHealth.toLong(), calcMaxHealth.toLong(), ).getChatColor() + NumberUtil.format(calcHealth) if (!SkyHanniMod.feature.slayer.endermen.phaseDisplay) { @@ -831,7 +831,7 @@ object DamageIndicatorManager { entityResult.delayedStart?.asTimeMark(), entityResult.finalDungeonBoss, entityResult.bossType, - foundTime = SimpleTimeMark.now() + foundTime = SimpleTimeMark.now(), ) DamageIndicatorDetectedEvent(entityData).postAndCatch() return entityData diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt index b3dabadd5..4e1c51de3 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt @@ -197,7 +197,7 @@ object SkyHanniDebugsAndTests { resetConfig() }, prefix = false, - oneTimeClick = true + oneTimeClick = true, ) } @@ -507,7 +507,7 @@ object SkyHanniDebugsAndTests { if (Minecraft.getMinecraft().gameSettings.showDebugInfo && debugConfig.currentAreaDebug) { config.debugLocationPos.renderString( "Current Area: ${HypixelData.skyBlockArea}", - posLabel = "SkyBlock Area (Debug)" + posLabel = "SkyBlock Area (Debug)", ) } @@ -523,7 +523,7 @@ object SkyHanniDebugsAndTests { val scale = 0.1 val renderables = listOf( ItemStack(Blocks.glass_pane), ItemStack(Items.diamond_sword), ItemStack(Items.skull), - ItemStack(Blocks.melon_block) + ItemStack(Blocks.melon_block), ).map { item -> generateSequence(scale) { it + 0.1 }.take(25).map { Renderable.itemStack(item, it, xSpacing = 0).renderBounds() @@ -531,7 +531,7 @@ object SkyHanniDebugsAndTests { }.editCopy { this.add( 0, - generateSequence(scale) { it + 0.1 }.take(25).map { Renderable.string(it.round(1).toString()) }.toList() + generateSequence(scale) { it + 0.1 }.take(25).map { Renderable.string(it.round(1).toString()) }.toList(), ) } config.debugItemPos.renderRenderables( @@ -540,10 +540,12 @@ object SkyHanniDebugsAndTests { Renderable.horizontalContainer( listOf( Renderable.string("Test:").renderBounds(), - Renderable.itemStack(ItemStack(Items.diamond_sword)).renderBounds() - ), spacing = 1 - ) - ), posLabel = "Item Debug" + Renderable.itemStack(ItemStack(Items.diamond_sword)).renderBounds(), + ), + spacing = 1, + ), + ), + posLabel = "Item Debug", ) } -- cgit