aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Cole <40234707+DavidArthurCole@users.noreply.github.com>2024-10-11 12:42:33 -0400
committerGitHub <noreply@github.com>2024-10-11 18:42:33 +0200
commit7c2d4ed566246513bc438272e436627412147d62 (patch)
treeedf8d3d01a49bd7c4f5993bae6367613c32fcaac
parent0671e35163d55ab0f940aa6806a0d7bfb2876429 (diff)
downloadskyhanni-7c2d4ed566246513bc438272e436627412147d62.tar.gz
skyhanni-7c2d4ed566246513bc438272e436627412147d62.tar.bz2
skyhanni-7c2d4ed566246513bc438272e436627412147d62.zip
Backend: Detekt Fixes Part 6 (#2657)
Co-authored-by: Cal <cwolfson58@gmail.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
-rw-r--r--.idea/dictionaries/default_user.xml3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt24
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerNameFormatter.kt42
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/event/PlayerAllChatEvent.kt19
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/mob/Mob.kt17
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardTips.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/CollectionStep.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt41
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/commands/PartyChatCommands.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonArchitectFeatures.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/carnival/CarnivalZombieShootout.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaFixChat.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEventSummary.kt11
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityNpc.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishAPI.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt2
-rwxr-xr-xsrc/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt23
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropSpeedMeter.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt26
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt26
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenPlotMenuHighlighting.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/HighlightVisitorsOutsideOfGarden.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt41
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvent.kt18
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/MaxPurseItems.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ReforgeHelper.kt22
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt194
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/SkyblockGuideHighlightFeature.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt17
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTooltip.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/craft/CraftableItemList.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/ExperimentationTableAPI.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/SuperpairDataDisplay.kt20
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/SuperpairsClicksAlert.kt25
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseTracker.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/PrivateIslandNoPickaxeAbility.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordLocationKey.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt30
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt26
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantsJson.kt24
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboTimeTracker.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigFeatures.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigOptionGui.kt20
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/RiftAPI.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/VoltHighlighter.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/WoodenButtonsHelper.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingMetalSuitProgress.kt29
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt46
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt104
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/stranded/HighlightPlaceableNpcs.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/graph/GraphEditor.kt18
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/graph/GraphNodeEditor.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/CachedItemData.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt28
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ComputerTimeOffset.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt22
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/EssenceItemUtils.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ItemNameResolver.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/KSerializable.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NEUInternalName.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/chat/Text.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/guide/GuideTab.kt34
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/guide/GuideTablePage.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/json/FeatureTogglesByDefaultAdapter.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderableInventory.kt21
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderableUtils.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/tracker/BucketedItemTrackerData.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniBucketedItemTracker.kt4
117 files changed, 857 insertions, 595 deletions
diff --git a/.idea/dictionaries/default_user.xml b/.idea/dictionaries/default_user.xml
index 4c56b1303..86cfbc3f3 100644
--- a/.idea/dictionaries/default_user.xml
+++ b/.idea/dictionaries/default_user.xml
@@ -149,6 +149,7 @@
<w>mineman</w>
<w>mineshafts</w>
<w>miniboss</w>
+ <w>minigame</w>
<w>mirrorverse</w>
<w>misclick</w>
<w>missclick</w>
@@ -281,4 +282,4 @@
<w>yolkar</w>
</words>
</dictionary>
-</component>
+</component> \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt
index 0e35e602f..ba8e42d66 100644
--- a/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt
@@ -486,7 +486,8 @@ object SkillAPI {
1 -> listOf("levelwithxp", "xpforlevel", "goal")
2 -> if (strings[0].lowercase() == "goal") CommandBase.getListOfStringsMatchingLastWord(
strings,
- SkillType.entries.map { it.displayName })
+ SkillType.entries.map { it.displayName }
+ )
else
listOf()
@@ -502,7 +503,8 @@ object SkillAPI {
"§6/shskills goal - §bView your current goal",
"§6/shskills goal <skill> <level> - §bDefine your goal for <skill>",
"",
- ).joinToString("\n"), prefix = false
+ ).joinToString("\n"),
+ prefix = false
)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt
index 7c41245fc..c9ae8c2c7 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt
@@ -120,21 +120,27 @@ object ConfigUpdaterMigrator {
logger.log("Starting config transformation from $i to ${i + 1}")
val storage = accumulator["storage"]?.asJsonObject
val dynamicPrefix: Map<String, List<String>> = mapOf(
- "#profile" to
- (storage?.get("players")?.asJsonObject?.entrySet()
+ "#profile" to (
+ storage?.get("players")?.asJsonObject?.entrySet()
?.flatMap { player ->
player.value.asJsonObject["profiles"]?.asJsonObject?.entrySet()?.map {
"storage.players.${player.key}.profiles.${it.key}"
} ?: listOf()
}
- ?: listOf()),
- "#player" to
- (storage?.get("players")?.asJsonObject?.entrySet()?.map { "storage.players.${it.key}" }
- ?: listOf()),
+ ?: listOf()
+ ),
+ "#player" to (
+ storage?.get("players")?.asJsonObject?.entrySet()?.map { "storage.players.${it.key}" }
+ ?: listOf()
+ ),
)
- val migration = ConfigFixEvent(accumulator, JsonObject().also {
- it.add("lastVersion", JsonPrimitive(i + 1))
- }, i, 0, dynamicPrefix).also { it.postAndCatch() }
+ val migration = ConfigFixEvent(
+ accumulator,
+ JsonObject().also {
+ it.add("lastVersion", JsonPrimitive(i + 1))
+ },
+ i, 0, dynamicPrefix
+ ).also { it.postAndCatch() }
logger.log("Transformations scheduled: ${migration.new}")
val mergesPerformed = merge(migration.old, migration.new)
logger.log("Migration done with $mergesPerformed merges and ${migration.movesPerformed} moves performed")
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
index 4974c80f2..44565aa95 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
@@ -507,7 +507,9 @@ object Commands {
private fun developersCodingHelp() {
registerCommand("shrepopatterns", "See where regexes are loaded from") { RepoPatternGui.open() }
registerCommand("shtest", "Unused test command.") { SkyHanniDebugsAndTests.testCommand(it) }
- registerCommand("shtestrabbitpaths", "Tests pathfinding to rabbit eggs. Use a number 0-14.") { HoppityEggLocator.testPathfind(it) }
+ registerCommand("shtestrabbitpaths", "Tests pathfinding to rabbit eggs. Use a number 0-14.") {
+ HoppityEggLocator.testPathfind(it)
+ }
registerCommand(
"shtestitem",
"test item internal name resolving",
diff --git a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerNameFormatter.kt b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerNameFormatter.kt
index edc4f65b0..35356f32f 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerNameFormatter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/PlayerNameFormatter.kt
@@ -125,32 +125,38 @@ object PlayerNameFormatter {
fun onPrivateChat(event: PrivateMessageChatEvent) {
if (!isEnabled()) return
event.chatComponent =
- StringUtils.replaceIfNeeded(event.chatComponent, Text.text("§d${event.direction}") {
- appendText(" ")
- appendSibling(nameFormat(event.authorComponent))
- appendText("§f: ")
- appendSibling(event.messageComponent.intoComponent())
- }) ?: return
+ StringUtils.replaceIfNeeded(
+ event.chatComponent,
+ Text.text("§d${event.direction}") {
+ appendText(" ")
+ appendSibling(nameFormat(event.authorComponent))
+ appendText("§f: ")
+ appendSibling(event.messageComponent.intoComponent())
+ }
+ ) ?: return
}
@SubscribeEvent
fun onPlayerShowItemChat(event: PlayerShowItemChatEvent) {
if (!isEnabled()) return
- event.chatComponent = StringUtils.replaceIfNeeded(event.chatComponent, Text.text("") {
- appendSibling(
- nameFormat(
- event.authorComponent,
- levelColor = event.levelComponent?.sampleStyleAtStart()?.color?.toString(),
- level = event.levelComponent
+ event.chatComponent = StringUtils.replaceIfNeeded(
+ event.chatComponent,
+ Text.text("") {
+ appendSibling(
+ nameFormat(
+ event.authorComponent,
+ levelColor = event.levelComponent?.sampleStyleAtStart()?.color?.toString(),
+ level = event.levelComponent
+ )
)
- )
- appendText(" ")
- appendSibling(event.action.intoComponent().changeColor(LorenzColor.GRAY))
+ appendText(" ")
+ appendSibling(event.action.intoComponent().changeColor(LorenzColor.GRAY))
- appendText(" ")
- appendSibling(event.item.intoComponent())
- }) ?: return
+ appendText(" ")
+ appendSibling(event.item.intoComponent())
+ }
+ ) ?: return
}
private fun nameFormat(
diff --git a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/event/PlayerAllChatEvent.kt b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/event/PlayerAllChatEvent.kt
index 7d6d1a7ac..e33165b34 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/event/PlayerAllChatEvent.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/hypixel/chat/event/PlayerAllChatEvent.kt
@@ -21,11 +21,14 @@ class PlayerAllChatEvent(
val isAGuest by lazy { privateIslandGuest != null }
companion object {
- private val listenerList = ListenerList(AbstractChatEvent(
- ComponentSpan.empty(),
- ComponentSpan.empty(),
- ChatComponentText(""),
- "").listenerList)
+ private val listenerList = ListenerList(
+ AbstractChatEvent(
+ ComponentSpan.empty(),
+ ComponentSpan.empty(),
+ ChatComponentText(""),
+ ""
+ ).listenerList
+ )
}
/**
@@ -45,8 +48,10 @@ class PlayerAllChatEvent(
* This method is required if [setup] is present.
*/
@ApiStatus.Internal
- constructor() : this(null, null, null, "",
- ComponentSpan.empty(), ComponentSpan.empty(), ChatComponentText(""))
+ constructor() : this(
+ null, null, null, "",
+ ComponentSpan.empty(), ComponentSpan.empty(), ChatComponentText("")
+ )
/**
* This method is required if [setup] is present.
diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/Mob.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/Mob.kt
index 7e7e9f96c..e9eb6729d 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/mob/Mob.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/mob/Mob.kt
@@ -154,9 +154,11 @@ class Mob(
relativeBoundingBox =
if (extraEntities.isNotEmpty()) makeRelativeBoundingBox() else null // Inlined updateBoundingBox()
- owner = (ownerName ?: if (mobType == Type.SLAYER) hologram2?.let {
- summonOwnerPattern.matchMatcher(it.cleanName()) { this.group("name") }
- } else null)?.let { MobUtils.OwnerShip(it) }
+ owner = (
+ ownerName ?: if (mobType == Type.SLAYER) hologram2?.let {
+ summonOwnerPattern.matchMatcher(it.cleanName()) { this.group("name") }
+ } else null
+ )?.let { MobUtils.OwnerShip(it) }
}
private fun removeExtraEntitiesFromChecking() =
@@ -164,15 +166,16 @@ class Mob(
MobData.externRemoveOfRetryAmount += it
}
- fun updateBoundingBox() {
+ private fun updateBoundingBox() {
relativeBoundingBox = if (extraEntities.isNotEmpty()) makeRelativeBoundingBox() else null
}
- private fun makeRelativeBoundingBox() =
- (baseEntity.entityBoundingBox.union(
+ private fun makeRelativeBoundingBox() = (
+ baseEntity.entityBoundingBox.union(
extraEntities.filter { it !is EntityArmorStand }
.mapNotNull { it.entityBoundingBox },
- ))?.offset(-baseEntity.posX, -baseEntity.posY, -baseEntity.posZ)
+ )
+ )?.offset(-baseEntity.posX, -baseEntity.posY, -baseEntity.posZ)
fun fullEntityList() =
baseEntity.toSingletonListOrEmpty() +
diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt
index 34f776308..014e0a846 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt
@@ -97,8 +97,9 @@ object MobDetection {
}
private fun Mob.watchdogCheck(world: World): Boolean =
- this.baseEntity.worldObj != world || (this.armorStand?.let { it.worldObj != world }
- ?: false) || this.extraEntities.any { it.worldObj != world }
+ this.baseEntity.worldObj != world || (
+ this.armorStand?.let { it.worldObj != world } ?: false
+ ) || this.extraEntities.any { it.worldObj != world }
@SubscribeEvent
fun onTick(event: LorenzTickEvent) {
@@ -338,7 +339,7 @@ object MobDetection {
private fun handleEntityUpdate(entityID: Int): Boolean {
val entity = EntityUtils.getEntityByID(entityID) as? EntityLivingBase ?: return false
- getRetry(entity)?.apply { this.entity = entity }
+ getRetry(entity)?.entity = entity
MobData.currentEntityLiving.refreshReference(entity)
MobData.previousEntityLiving.refreshReference(entity)
// update map
@@ -353,10 +354,10 @@ object MobDetection {
is S0CPacketSpawnPlayer -> addEntityUpdate(packet.entityID)
// is S0EPacketSpawnObject -> addEntityUpdate(packet.entityID)
is S01PacketJoinGame -> // one of the first packets that is sent when switching servers inside the BungeeCord Network (please some prove this, I just found it out via Testing)
- {
- shouldClear.set(true)
- allEntitiesViaPacketId.clear()
- }
+ {
+ shouldClear.set(true)
+ allEntitiesViaPacketId.clear()
+ }
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt
index a9f8a1453..5d6111336 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt
@@ -243,8 +243,10 @@ object MobFilter {
baseEntity,
armorStand,
extraEntityList,
- ) else (MobFactories.basic(baseEntity, armorStand, extraEntityList)
- ?: MobFactories.dojo(baseEntity, armorStand))
+ ) else (
+ MobFactories.basic(baseEntity, armorStand, extraEntityList)
+ ?: MobFactories.dojo(baseEntity, armorStand)
+ )
private fun noArmorStandMobs(baseEntity: EntityLivingBase): MobResult? = when {
baseEntity is EntityBat -> createBat(baseEntity)
diff --git a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt
index b3109c9ee..babbb2558 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt
@@ -165,8 +165,8 @@ class RepoManager(private val configLocation: File) {
}
}
- private fun reloadRepository(answerMessage: String = ""): CompletableFuture<Void?> {
- val comp = CompletableFuture<Void?>()
+ private fun reloadRepository(answerMessage: String = ""): CompletableFuture<Unit?> {
+ val comp = CompletableFuture<Unit?>()
if (!atomicShouldManuallyReload.get()) return comp
ErrorManager.resetCache()
DelayedRun.onThread.execute {
@@ -232,8 +232,10 @@ class RepoManager(private val configLocation: File) {
if (unsuccessfulConstants.isNotEmpty()) {
val text = mutableListOf<IChatComponent>()
text.add(
- ("§c[SkyHanni-${SkyHanniMod.version}] §7Repo Issue! Some features may not work. " +
- "Please report this error on the Discord!").asComponent(),
+ (
+ "§c[SkyHanni-${SkyHanniMod.version}] §7Repo Issue! Some features may not work. " +
+ "Please report this error on the Discord!"
+ ).asComponent(),
)
text.add("§7Repo Auto Update Value: §c${config.repoAutoUpdate}".asComponent())
text.add("§7If you have Repo Auto Update turned off, please try turning that on.".asComponent())
@@ -286,13 +288,13 @@ class RepoManager(private val configLocation: File) {
val repoUser = config.location.user
val repoName = config.location.name
val repoBranch = config.location.branch
- return String.format("https://api.github.com/repos/%s/%s/commits/%s", repoUser, repoName, repoBranch)
+ return "https://api.github.com/repos/$repoUser/$repoName/commits/$repoBranch"
}
private fun getDownloadUrl(commitId: String?): String {
val repoUser = config.location.user
val repoName = config.location.name
- return String.format("https://github.com/%s/%s/archive/%s.zip", repoUser, repoName, commitId)
+ return "https://github.com/$repoUser/$repoName/archive/$commitId.zip"
}
@Throws(IOException::class)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt
index 94bd4f6dd..b0f883ac2 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt
@@ -85,12 +85,15 @@ object BingoCardDisplay {
if (BingoAPI.bingoGoals.isEmpty()) {
newList.add(Renderable.string("§6Bingo Goals:"))
- newList.add(Renderable.clickAndHover("§cOpen the §e/bingo §ccard.",
- listOf("Click to run §e/bingo"),
- onClick = {
- HypixelCommands.bingo()
- }
- ))
+ newList.add(
+ Renderable.clickAndHover(
+ "§cOpen the §e/bingo §ccard.",
+ listOf("Click to run §e/bingo"),
+ onClick = {
+ HypixelCommands.bingo()
+ }
+ )
+ )
} else {
if (!config.hideCommunityGoals.get()) {
newList.addCommunityGoals()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardTips.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardTips.kt
index abf8bbedc..83b41d3fd 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardTips.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardTips.kt
@@ -81,9 +81,7 @@ object BingoCardTips {
for (line in bingoTip.guide) {
toolTip.add(index++, " $line")
}
- bingoTip.found?.let {
- toolTip.add(index++, "§7Found by: §e$it")
- }
+ toolTip.add(index++, "§7Found by: §e${bingoTip.found}")
}
@SubscribeEvent
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt
index 2e56a536b..69602ec70 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt
@@ -275,7 +275,8 @@ object BingoNextStepHelper {
"Emerald",
160 * 32,
mapOf("Emerald" to 1, "Enchanted Emerald" to 160)
- ) requires IslandType.DWARVEN_MINES.getStep())
+ ) requires IslandType.DWARVEN_MINES.getStep()
+ )
}
if (description == "Obtain a Mathematical Hoe Blueprint.") {
@@ -285,7 +286,8 @@ object BingoNextStepHelper {
"Jacob's Ticket",
32,
mapOf("Jacob's Ticket" to 1)
- ).addItemRequirements() requires IslandType.GARDEN.getStep())
+ ).addItemRequirements() requires IslandType.GARDEN.getStep()
+ )
}
crystalPattern.matchMatcher(description) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/CollectionStep.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/CollectionStep.kt
index 7871ae28d..10c968d84 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/CollectionStep.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/CollectionStep.kt
@@ -6,5 +6,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
class CollectionStep(collectionName: String, amountNeeded: Int) :
ProgressionStep(amountNeeded.shortFormat() + " $collectionName Collection", amountNeeded.toLong()) {
- val internalName by lazy { NEUInternalName.fromItemName(if (collectionName == "Mushroom") "Red Mushroom" else collectionName) }
+ val internalName by lazy {
+ NEUInternalName.fromItemName(if (collectionName == "Mushroom") "Red Mushroom" else collectionName)
+ }
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt
index d256bfe63..2afc9276b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt
@@ -35,7 +35,8 @@ object PlayerDeathMessages {
if (MarkedPlayerManager.config.highlightInChat &&
!DungeonAPI.inDungeon() &&
!LorenzUtils.inKuudraFight &&
- MarkedPlayerManager.isMarkedPlayer(name)) {
+ MarkedPlayerManager.isMarkedPlayer(name)
+ ) {
val reason = event.reason
val color = MarkedPlayerManager.config.chatColor.getChatColor()
ChatUtils.chat(" §c☠ $color$name §7$reason", false)
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 3b2b93680..f40e437e5 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt
@@ -279,10 +279,12 @@ object BestiaryData {
val isUnlocked = mob.actualRealTotalKill != 0.toLong()
val isMaxed = mob.percentToMax() >= 1
if (!isUnlocked) {
- newDisplay.add(buildList {
- add(" §7- ")
- add("${mob.name}: §cNot unlocked!")
- })
+ newDisplay.add(
+ buildList {
+ add(" §7- ")
+ add("${mob.name}: §cNot unlocked!")
+ }
+ )
continue
}
if (isMaxed && config.hideMaxed) continue
@@ -358,7 +360,8 @@ object BestiaryData {
// todo: avoid ordinal
config.numberFormat = BestiaryConfig.NumberFormatEntry.entries[(config.numberFormat.ordinal + 1) % 2]
update()
- })
+ }
+ )
newDisplay.addButton(
prefix = "§7Display Type: ",
@@ -367,7 +370,8 @@ object BestiaryData {
// todo: avoid ordinal
config.displayType = DisplayTypeEntry.entries[(config.displayType.ordinal + 1) % 8]
update()
- })
+ }
+ )
newDisplay.addButton(
prefix = "§7Number Type: ",
@@ -377,6 +381,7 @@ object BestiaryData {
update()
}
)
+
newDisplay.addButton(
prefix = "§7Hide Maxed: ",
getName = HideMaxed.entries[if (config.hideMaxed) 1 else 0].type,
@@ -391,18 +396,20 @@ object BestiaryData {
if (catList.isNotEmpty()) {
newDisplay.addAsSingletonList("§7Category")
for (cat in catList) {
- newDisplay.add(buildList {
- add(" §7- ${cat.name}§7: ")
- val element = when {
- cat.familiesCompleted == cat.totalFamilies -> "§c§lCompleted!"
- cat.familiesFound == cat.totalFamilies -> "§b${cat.familiesCompleted}§7/§b${cat.totalFamilies} §7completed"
- cat.familiesFound < cat.totalFamilies ->
- "§b${cat.familiesFound}§7/§b${cat.totalFamilies} §7found, §b${cat.familiesCompleted}§7/§b${cat.totalFamilies} §7completed"
-
- else -> continue
+ newDisplay.add(
+ buildList {
+ add(" §7- ${cat.name}§7: ")
+ val element = when {
+ cat.familiesCompleted == cat.totalFamilies -> "§c§lCompleted!"
+ cat.familiesFound == cat.totalFamilies -> "§b${cat.familiesCompleted}§7/§b${cat.totalFamilies} §7completed"
+ cat.familiesFound < cat.totalFamilies ->
+ "§b${cat.familiesFound}§7/§b${cat.totalFamilies} §7found, §b${cat.familiesCompleted}§7/§b${cat.totalFamilies} §7completed"
+
+ else -> continue
+ }
+ add(element)
}
- add(element)
- })
+ )
}
}
}
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 4f0dad4b8..7f5b42e3c 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
@@ -367,8 +367,8 @@ object DamageIndicatorManager {
getCustomHealth(entityData, health, entity, maxHealth) ?: return null
}
- if (data.containsKey(entity.uniqueID)) {
- val lastHealth = data[entity.uniqueID]!!.lastHealth
+ data[entity.uniqueID]?.let {
+ val lastHealth = it.lastHealth
checkDamage(entityData, health, lastHealth)
tickDamage(entityData.damageCounter)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt
index 0363543bf..4a0bed69c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt
@@ -148,7 +148,9 @@ object EnderNodeTracker {
if (!isEnabled()) return
if (!ProfileStorageData.loaded) return
- val change = event.sackChanges.firstOrNull { it.internalName == EnderNode.MITE_GEL.internalName && it.delta > 0 } ?: return
+ val change = event.sackChanges.firstOrNull {
+ it.internalName == EnderNode.MITE_GEL.internalName && it.delta > 0
+ } ?: return
tracker.modify { storage ->
storage.lootCount.addOrPut(EnderNode.MITE_GEL, change.delta)
@@ -268,7 +270,11 @@ object EnderNodeTracker {
addSearchString("§f$c§7-§a$u§7-§9$r§7-§5$e§7-§6$l §fEnderman Pet §7(§6$profit§7)")
}
- private fun calculateEnderArmor(storage: Data) = storage.lootCount.filter { isEnderArmor(it.key) }.map { it.value }.sum()
+ private fun calculateEnderArmor(storage: Data) = storage.lootCount.filter {
+ isEnderArmor(it.key)
+ }.map {
+ it.value
+ }.sum()
private fun formatDisplay(map: List<Searchable>): List<Searchable> {
if (!ProfileStorageData.loaded) return emptyList()
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 14abcfad6..2ef652e4a 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
@@ -385,7 +385,7 @@ object GhostCounter {
}
percent = 100f.coerceAtMost(percent)
if (!parse) {
- sb.append(" (").append(String.format("%.2f", percent)).append("%)")
+ sb.append(" (").append(String.format(Locale.US, "%.2f", percent)).append("%)")
} else {
sb.append(" (").append(nf.format(currentSkillXp))
if (totalSkillXp != 0) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/PartyChatCommands.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/PartyChatCommands.kt
index b6bcff3bd..4651570e4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/commands/PartyChatCommands.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/commands/PartyChatCommands.kt
@@ -200,8 +200,8 @@ object PartyChatCommands {
var message = "Ignored player list:"
if (blacklist.size > 15) {
message += "\n§e"
- blacklist.forEachIndexed { i, it ->
- message += it
+ blacklist.forEachIndexed { i, blacklistedMessage ->
+ message += blacklistedMessage
if (i < blacklist.size - 1) {
message += ", "
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt
index 8b2d60069..377d7bfd4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt
@@ -138,9 +138,11 @@ object CroesusChestTracker {
val lore = item.getLore()
if (run.floor == null) run.floor =
- (if (masterPattern.matches(item.name)) "M" else "F") + (lore.firstNotNullOfOrNull {
- floorPattern.matchMatcher(it) { group("floor").romanToDecimal() }
- } ?: "0")
+ (if (masterPattern.matches(item.name)) "M" else "F") + (
+ lore.firstNotNullOfOrNull {
+ floorPattern.matchMatcher(it) { group("floor").romanToDecimal() }
+ } ?: "0"
+ )
run.openState = when {
keyUsedPattern.anyMatches(lore) -> OpenedState.KEY_USED
openedPattern.anyMatches(lore) -> OpenedState.OPENED
@@ -274,11 +276,12 @@ object CroesusChestTracker {
fun generateMaxChestAsList(): List<DungeonRunInfo> = generateMaxChest().toList()
private fun generateMaxChest(): Sequence<DungeonRunInfo> = generateSequence { DungeonRunInfo() }.take(MAX_CHESTS)
- fun getLastActiveChest(includeDungeonKey: Boolean = false): Int =
- (croesusChests?.indexOfLast {
+ private fun getLastActiveChest(includeDungeonKey: Boolean = false): Int = (
+ croesusChests?.indexOfLast {
it.floor != null &&
(it.openState == OpenedState.UNOPENED || (includeDungeonKey && it.openState == OpenedState.OPENED))
- } ?: -1) + 1
+ } ?: -1
+ ) + 1
enum class OpenedState {
UNOPENED,
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonArchitectFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonArchitectFeatures.kt
index 662c36604..284f8424f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonArchitectFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonArchitectFeatures.kt
@@ -49,7 +49,8 @@ object DungeonArchitectFeatures {
if (architectItemAmount <= 0) return
GetFromSackAPI.getFromChatMessageSackItems(
- architectsFirstDraft, "§c§lPUZZLE FAILED! §r§b$name §r§efailed a puzzle. \n" +
+ architectsFirstDraft,
+ "§c§lPUZZLE FAILED! §r§b$name §r§efailed a puzzle. \n" +
"§eClick here to get §5Architect's First Draft §7(§e${architectItemAmount}x left§7)"
)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt
index a5237aeb6..4f29aca52 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt
@@ -202,7 +202,9 @@ object DungeonHideItems {
}
private fun shouldColorMovingSkull(entity: Entity) =
- SkyHanniMod.feature.dungeon.highlightSkeletonSkull && movingSkeletonSkulls[entity]?.let { it + 200 > System.currentTimeMillis() } ?: false
+ SkyHanniMod.feature.dungeon.highlightSkeletonSkull && movingSkeletonSkulls[entity]?.let {
+ it + 200 > System.currentTimeMillis()
+ } ?: false
@SubscribeEvent
fun onWorldChange(event: LorenzWorldChangeEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt
index 474e8367f..9cc4b8a10 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLividFinder.kt
@@ -63,7 +63,7 @@ object DungeonLividFinder {
if (event.isMod(20)) {
if (lividArmorStand == null) {
- val amountArmorStands = EntityUtils.getEntities<EntityArmorStand>().filter { it.name.contains("Livid") }.count()
+ val amountArmorStands = EntityUtils.getEntities<EntityArmorStand>().count { it.name.contains("Livid") }
if (amountArmorStands >= 8) {
ErrorManager.logErrorStateWithData(
"Could not find livid",
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/carnival/CarnivalZombieShootout.kt b/src/main/java/at/hannibal2/skyhanni/features/event/carnival/CarnivalZombieShootout.kt
index 9edf05b7b..8a0d4296f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/carnival/CarnivalZombieShootout.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/carnival/CarnivalZombieShootout.kt
@@ -86,9 +86,13 @@ object CarnivalZombieShootout {
zombie to type
}.toMap()
- drawZombies =
- if (config.highestOnly) nearbyZombies.filterValues { zombieType -> zombieType == nearbyZombies.values.maxByOrNull { it.points } }
- else nearbyZombies
+ drawZombies = if (config.highestOnly)
+ nearbyZombies.filterValues { zombieType ->
+ zombieType == nearbyZombies.values.maxByOrNull {
+ it.points
+ }
+ }
+ else nearbyZombies
lastUpdate.zombie = SimpleTimeMark.now()
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaFixChat.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaFixChat.kt
index 20cf553b8..2f3d19c24 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaFixChat.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaFixChat.kt
@@ -73,7 +73,8 @@ object DianaFixChat {
HypixelCommands.particleQuality("high")
errorCounter = 0
ChatUtils.chat("Now try again!")
- })
+ }
+ )
}
} else {
if (!hasSetToggleMusic) {
@@ -87,7 +88,8 @@ object DianaFixChat {
HypixelCommands.toggleMusic()
errorCounter = 0
ChatUtils.chat("Now try again, please!")
- })
+ }
+ )
}
} else {
ErrorManager.logErrorStateWithData(
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt
index 0bb5e3dc1..35016eda3 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/SoopyGuessBurrow.kt
@@ -175,7 +175,8 @@ object SoopyGuessBurrow {
}
val (a, b, c) = solveEquationThing(
- LorenzVec(slopeThing.size - 5, slopeThing.size - 3, slopeThing.size - 1), LorenzVec(
+ LorenzVec(slopeThing.size - 5, slopeThing.size - 3, slopeThing.size - 1),
+ LorenzVec(
slopeThing[slopeThing.size - 5],
slopeThing[slopeThing.size - 3],
slopeThing[slopeThing.size - 1]
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt
index 0a144aa2f..593326c67 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt
@@ -58,7 +58,9 @@ object HoppityAPI {
fun getLastRabbit(): String = this.lastNameCache
fun isHoppityEvent() = (SkyblockSeason.currentSeason == SkyblockSeason.SPRING || SkyHanniMod.feature.dev.debug.alwaysHoppitys)
- fun rarityByRabbit(rabbit: String): LorenzRarity? = hoppityRarities.firstOrNull { it.chatColorCode == rabbit.substring(0, 2) }
+ fun rarityByRabbit(rabbit: String): LorenzRarity? = hoppityRarities.firstOrNull {
+ it.chatColorCode == rabbit.substring(0, 2)
+ }
/**
* REGEX-TEST: §f1st Chocolate Milestone
@@ -111,14 +113,14 @@ object HoppityAPI {
EggFoundEvent(STRAY, it.slotNumber).post()
lastName = "§9Fish the Rabbit"
lastMeal = STRAY
- duplicate = it.stack.getLore().any { line -> duplicatePseudoStrayPattern.matches(line)}
+ duplicate = it.stack.getLore().any { line -> duplicatePseudoStrayPattern.matches(line) }
attemptFireRabbitFound()
}
"El Dorado" -> {
EggFoundEvent(STRAY, it.slotNumber).post()
lastName = "§6El Dorado"
lastMeal = STRAY
- duplicate = it.stack.getLore().any { line -> duplicateDoradoStrayPattern.matches(line)}
+ duplicate = it.stack.getLore().any { line -> duplicateDoradoStrayPattern.matches(line) }
attemptFireRabbitFound()
}
else -> return@matchMatcher
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt
index 7a5e726d2..e5425af34 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt
@@ -283,7 +283,9 @@ object HoppityEggLocator {
IslandGraphs.pathFind(location, "Hoppity Egg", color, condition = { config.showPathFinder })
}
- fun isValidEggLocation(location: LorenzVec): Boolean = HoppityEggLocations.islandLocations.any { it.distance(location) < 5.0 }
+ fun isValidEggLocation(location: LorenzVec): Boolean = HoppityEggLocations.islandLocations.any {
+ it.distance(location) < 5.0
+ }
private fun ReceiveParticleEvent.isVillagerParticle() = type == EnumParticleTypes.VILLAGER_HAPPY && speed == 0.0f && count == 1
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEventSummary.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEventSummary.kt
index b2f806c80..4a536465c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEventSummary.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEventSummary.kt
@@ -98,8 +98,8 @@ object HoppityEventSummary {
if (year < currentYear || (year == currentYear && !isSpring) && config.eventSummary.enabled) {
sendStatsMessage(stats, year)
- (ProfileStorageData.profileSpecific?.hoppityEventStats?.get(year)?.also { it.summarized = true }
- ?: ErrorManager.skyHanniError("Could not save summarization state in Hoppity Event Summarization."))
+ ProfileStorageData.profileSpecific?.hoppityEventStats?.get(year)?.also { it.summarized = true }
+ ?: ErrorManager.skyHanniError("Could not save summarization state in Hoppity Event Summarization.")
}
}
@@ -131,6 +131,10 @@ object HoppityEventSummary {
)
}
+ private fun HoppityEventStats.getMilestoneCount(): Int =
+ (mealsFound[HoppityEggType.CHOCOLATE_FACTORY_MILESTONE] ?: 0) +
+ (mealsFound[HoppityEggType.CHOCOLATE_SHOP_MILESTONE] ?: 0)
+
private val summaryOperationList by lazy {
buildMap<HoppityStat, (sb: StringBuilder, stats: HoppityEventStats, year: Int) -> Unit> {
put(HoppityStat.MEAL_EGGS_FOUND) { sb, stats, year ->
@@ -155,8 +159,7 @@ object HoppityEventSummary {
}
put(HoppityStat.MILESTONE_RABBITS) { sb, stats, _ ->
- ((stats.mealsFound[HoppityEggType.CHOCOLATE_FACTORY_MILESTONE] ?: 0) +
- (stats.mealsFound[HoppityEggType.CHOCOLATE_SHOP_MILESTONE] ?: 0)).takeIf { it > 0 }?.let {
+ stats.getMilestoneCount().takeIf { it > 0 }?.let {
sb.appendHeadedLine("§7You claimed §b$it §6§lMilestone §r§6${StringUtils.pluralize(it, "Rabbit")}§7.")
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityNpc.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityNpc.kt
index 0546e5ff9..bf324a8f6 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityNpc.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityNpc.kt
@@ -68,7 +68,8 @@ object HoppityNpc {
IslandGraphs.pathFind(
LorenzVec(6.4, 70.0, 7.4),
"§aHoppity's Shop",
- condition = { config.hoppityShopReminder })
+ condition = { config.hoppityShopReminder }
+ )
}
},
)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt
index 5f64aba8c..3eac15fc6 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt
@@ -64,7 +64,11 @@ object ChumBucketHider {
}
// Chum Bucket
- if (config.hideBucket.get() && entity.inventory.any { it != null && (it.name == "§fEmpty Chum Bucket" || it.name == "§aEmpty Chumcap Bucket") }) {
+ if (config.hideBucket.get() &&
+ entity.inventory.any {
+ it != null && (it.name == "§fEmpty Chum Bucket" || it.name == "§aEmpty Chumcap Bucket")
+ }
+ ) {
val entityLocation = entity.getLorenzVec()
for (title in titleEntity.toSet()) {
if (entityLocation.equalsIgnoreY(title.getLorenzVec())) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishAPI.kt
index fec662f39..3a6333a9c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishAPI.kt
@@ -21,7 +21,7 @@ object TrophyFishAPI {
|${TrophyRarity.BRONZE.formattedString}: ${formatCount(counts, TrophyRarity.BRONZE)}
|
|§7Total: ${bestFishObtained.formatCode}${counts.values.sum().addSeparators()}
- """.trimMargin()
+ """.trimMargin()
}
private fun formatCount(counts: Map<TrophyRarity, Int>, rarity: TrophyRarity): String {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt
index 6cbda5b04..760df6432 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt
@@ -76,7 +76,7 @@ object AnitaMedalProfit {
}
private fun readItem(slot: Int, item: ItemStack, table: MutableList<DisplayTableEntry>) {
- val itemName = getItemName(item) ?: return
+ val itemName = getItemName(item)
if (itemName == " ") return
if (itemName == "§cClose") return
if (itemName == "§eUnique Gold Medals") return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt
index 3a661161e..290c5427b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt
@@ -74,7 +74,9 @@ enum class CropType(
fun getByNameOrNull(itemName: String): CropType? {
if (itemName == "Red Mushroom" || itemName == "Brown Mushroom") return MUSHROOM
if (itemName == "Seeds") return WHEAT
- return entries.firstOrNull { it.cropName.equals(itemName, ignoreCase = true) || it.simpleName.equals(itemName, ignoreCase = true) }
+ return entries.firstOrNull {
+ it.cropName.equals(itemName, ignoreCase = true) || it.simpleName.equals(itemName, ignoreCase = true)
+ }
}
fun getByName(name: String) = getByNameOrNull(name) ?: error("No valid crop type '$name'")
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 c79bbb461..d0a386272 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt
@@ -515,8 +515,10 @@ object GardenNextJacobContest {
}
private fun isEnabled() =
- config.display && ((LorenzUtils.inSkyBlock && (GardenAPI.inGarden() || config.showOutsideGarden)) ||
- (OutsideSbFeature.NEXT_JACOB_CONTEST.isSelected() && !LorenzUtils.inSkyBlock))
+ config.display && (
+ (LorenzUtils.inSkyBlock && (GardenAPI.inGarden() || config.showOutsideGarden)) ||
+ (OutsideSbFeature.NEXT_JACOB_CONTEST.isSelected() && !LorenzUtils.inSkyBlock)
+ )
private fun isFetchEnabled() = isEnabled() && config.fetchAutomatically
private fun isSendEnabled() =
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt
index 8ad8d21da..373eadfe9 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt
@@ -191,7 +191,7 @@ object GardenPlotAPI {
}
fun Plot.markExpiredSprayAsNotified() {
- getData()?.apply { sprayHasNotified = true }
+ getData()?.sprayHasNotified = true
}
private fun Plot.setSpray(spray: SprayType, duration: Duration) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt
index 171df87e7..ef1aaa1bd 100755
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenYawAndPitch.kt
@@ -60,8 +60,10 @@ object GardenYawAndPitch {
}
private fun isEnabled() =
- config.enabled && ((OutsideSbFeature.YAW_AND_PITCH.isSelected() && !LorenzUtils.inSkyBlock) ||
- (LorenzUtils.inSkyBlock && (GardenAPI.inGarden() || config.showOutsideGarden)))
+ config.enabled && (
+ (OutsideSbFeature.YAW_AND_PITCH.isSelected() && !LorenzUtils.inSkyBlock) ||
+ (LorenzUtils.inSkyBlock && (GardenAPI.inGarden() || config.showOutsideGarden))
+ )
@SubscribeEvent
fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt
index 058ae1590..ffc77934b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt
@@ -49,7 +49,7 @@ object ComposterDisplay {
val pattern by lazy { rawPattern.toPattern() }
fun addToList(map: Map<DataType, String>): List<Any> {
- return listOf(displayItem, map[this]!!)
+ return map[this]?.let { listOf(displayItem, it) } ?: emptyList()
}
}
@@ -72,7 +72,6 @@ object ComposterDisplay {
val newDisplay = mutableListOf<List<Any>>()
newDisplay.addAsSingletonList("§bComposter")
-
newDisplay.add(DataType.TIME_LEFT.addToList(tabListData))
val list = mutableListOf<Any>()
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 d7452725f..6059eded9 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
@@ -344,7 +344,7 @@ object ComposterOverlay {
newList.addAsSingletonList(" §7$compostPerTitle: §e${multiplier.roundTo(2)}$compostPerTitlePreview")
val organicMatterPrice = getPrice(organicMatterItem)
- val organicMatterFactor = organicMatterFactors[organicMatterItem]!!
+ val organicMatterFactor = organicMatterFactors[organicMatterItem] ?: 1.0
val organicMatterRequired = ComposterAPI.organicMatterRequiredPer(null)
val organicMatterRequiredPreview = ComposterAPI.organicMatterRequiredPer(upgrade)
@@ -353,7 +353,7 @@ object ComposterOverlay {
val organicMatterPricePerPreview = organicMatterPrice * (organicMatterRequiredPreview / organicMatterFactor)
val fuelPrice = getPrice(fuelItem)
- val fuelFactor = fuelFactors[fuelItem]!!
+ val fuelFactor = fuelFactors[fuelItem] ?: 1.0
val fuelRequired = ComposterAPI.fuelRequiredPer(null)
val fuelRequiredPreview = ComposterAPI.fuelRequiredPer(upgrade)
@@ -427,7 +427,7 @@ object ComposterOverlay {
i++
if (i < testOffset) continue
if (first == null) first = internalName
- val factor = factors[internalName]!!
+ val factor = factors[internalName] ?: 1.0
val item = internalName.getItemStack()
val price = getPrice(internalName)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt
index bb9f9ea21..399c4cfad 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt
@@ -168,16 +168,19 @@ object JacobContestTimeNeeded {
showLine = line
}
}
- map[crop] = Renderable.hoverTips(showLine, buildList {
- add("§7Time Needed for §9${crop.cropName} Medals§7:")
- addAll(brackets)
- add("")
- val latestFF = crop.getLatestTrueFarmingFortune() ?: 0.0
- add("§7Latest FF: §e${(latestFF).addSeparators()}")
- val bps = crop.getBps()?.roundTo(1) ?: 0
- add("§7${addBpsTitle()}§e${bps.addSeparators()}")
- addAll(lowBPSWarning)
- })
+ map[crop] = Renderable.hoverTips(
+ showLine,
+ buildList {
+ add("§7Time Needed for §9${crop.cropName} Medals§7:")
+ addAll(brackets)
+ add("")
+ val latestFF = crop.getLatestTrueFarmingFortune() ?: 0.0
+ add("§7Latest FF: §e${(latestFF).addSeparators()}")
+ val bps = crop.getBps()?.roundTo(1) ?: 0
+ add("§7${addBpsTitle()}§e${bps.addSeparators()}")
+ addAll(lowBPSWarning)
+ }
+ )
}
private fun addBpsTitle() = if (config.jacobContestCustomBps) "Custom Blocks/Second: " else "Your Blocks/Second: "
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 217da9735..87306744e 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
@@ -229,7 +229,7 @@ object CropMoneyDisplay {
}
val coinsColor = if (isCurrent && config.compact) "§e" else "§6"
- val moneyArray = moneyPerHourData[internalName]!!
+ val moneyArray = moneyPerHourData[internalName] ?: emptyArray()
for (price in moneyArray) {
val finalPrice = price + extraMushroomCowPerkCoins + extraDicerCoins + extraArmorCoins
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropSpeedMeter.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropSpeedMeter.kt
index 74c59674f..9a47acaa1 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropSpeedMeter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropSpeedMeter.kt
@@ -89,7 +89,7 @@ object CropSpeedMeter {
snapshot = emptyList()
} else {
currentCrop?.let {
- val crops = it.getCounter() - startCrops[it]!!
+ val crops = it.getCounter() - (startCrops[it] ?: 0L)
val blocks = currentBlocks
val cropsPerBlocks = (crops.toDouble() / blocks.toDouble()).roundTo(3)
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 24edf8d43..3da9945b5 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
@@ -123,12 +123,6 @@ object FarmingWeightDisplay {
private var nextPlayers = mutableListOf<UpcomingLeaderboardPlayer>()
private val nextPlayer get() = nextPlayers.firstOrNull()
- private val recalculate by lazy {
- ({
- resetData()
- })
- }
-
private val eliteWeightApiGson by lazy {
BaseGsonBuilder.gson()
.registerTypeAdapter(CropType::class.java, SkyHanniTypeAdapters.CROP_TYPE.nullSafe())
@@ -141,22 +135,22 @@ object FarmingWeightDisplay {
Renderable.clickAndHover(
"§cFarming Weight error: Cannot load",
listOf("§eClick here to reload the data right now!"),
- onClick = recalculate,
+ onClick = ::resetData,
),
Renderable.clickAndHover(
"§cdata from Elite Farmers!",
listOf("§eClick here to reload the data right now!"),
- onClick = recalculate,
+ onClick = ::resetData,
),
Renderable.clickAndHover(
"§eRejoin the garden or",
listOf("§eClick here to reload the data right now!"),
- onClick = recalculate,
+ onClick = ::resetData,
),
Renderable.clickAndHover(
"§eclick here to fix it.",
listOf("§eClick here to reload the data right now!"),
- onClick = recalculate,
+ onClick = ::resetData,
),
)
}
@@ -268,7 +262,7 @@ object FarmingWeightDisplay {
val nextPlayer = nextPlayer ?: return Renderable.clickAndHover(
"§cWaiting for leaderboard update...",
listOf("§eClick here to load new data right now!"),
- onClick = recalculate,
+ onClick = ::resetData,
)
val showRankGoal = leaderboardPosition == -1 || leaderboardPosition > rankGoal
var nextName =
@@ -304,7 +298,7 @@ object FarmingWeightDisplay {
return Renderable.clickAndHover(
"§cRejoin the garden to show ETA!",
listOf("Click here to calculate the data right now!"),
- onClick = recalculate,
+ onClick = ::resetData,
)
}
@@ -366,8 +360,12 @@ object FarmingWeightDisplay {
)
}
- private fun isEnabled() = ((OutsideSbFeature.FARMING_WEIGHT.isSelected() && !LorenzUtils.inSkyBlock) ||
- (LorenzUtils.inSkyBlock && (GardenAPI.inGarden() || config.showOutsideGarden))) && config.display
+ private fun isEnabled() = (
+ config.display && (
+ OutsideSbFeature.FARMING_WEIGHT.isSelected() && !LorenzUtils.inSkyBlock
+ ) ||
+ (LorenzUtils.inSkyBlock && (GardenAPI.inGarden() || config.showOutsideGarden))
+ )
private fun isEtaEnabled() = config.overtakeETA
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt
index 7189199a9..aca1751b0 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt
@@ -156,14 +156,16 @@ object GardenCropMilestoneDisplay {
val useCustomGoal = customTargetLevel != 0 && customTargetLevel > currentTier
nextTier = if (useCustomGoal) customTargetLevel else nextTier
- lineMap[MilestoneTextEntry.MILESTONE_TIER] = Renderable.horizontalContainer(buildList {
- addCropIconRenderable(crop)
- if (crop.isMaxed(overflowDisplay) && !overflowDisplay) {
- addString("§7" + crop.cropName + " §eMAXED")
- } else {
- addString("§7" + crop.cropName + " §8$currentTier➜§3$nextTier")
+ lineMap[MilestoneTextEntry.MILESTONE_TIER] = Renderable.horizontalContainer(
+ buildList {
+ addCropIconRenderable(crop)
+ if (crop.isMaxed(overflowDisplay) && !overflowDisplay) {
+ addString("§7" + crop.cropName + " §eMAXED")
+ } else {
+ addString("§7" + crop.cropName + " §8$currentTier➜§3$nextTier")
+ }
}
- })
+ )
val allowOverflowOrCustom = overflowDisplay || useCustomGoal
val cropsForNextTier = GardenCropMilestones.getCropsForTier(nextTier, crop, allowOverflowOrCustom)
@@ -302,10 +304,12 @@ object GardenCropMilestoneDisplay {
val missing = need - have
lineMap[MushroomTextEntry.TITLE] = Renderable.string("§6Mooshroom Cow Perk")
- lineMap[MushroomTextEntry.MUSHROOM_TIER] = Renderable.horizontalContainer(buildList {
- addCropIconRenderable(mushroom)
- addString("§7Mushroom Milestone $nextTier")
- })
+ lineMap[MushroomTextEntry.MUSHROOM_TIER] = Renderable.horizontalContainer(
+ buildList {
+ addCropIconRenderable(mushroom)
+ addString("§7Mushroom Milestone $nextTier")
+ }
+ )
lineMap[MushroomTextEntry.NUMBER_OUT_OF_TOTAL] = Renderable.string("§e$haveFormat§8/§e$needFormat")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt
index 660c772ab..3771dd112 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt
@@ -53,9 +53,13 @@ class FFGuideGUI : GuideGUI<FFGuideGUI.FortuneGuidePage>(FortuneGuidePage.OVERVI
vTab(ItemStack(Items.gold_ingot), Renderable.string("§eBreakdown")) {
currentPage = if (currentCrop == null) FortuneGuidePage.OVERVIEW else FortuneGuidePage.CROP
},
- vTab(ItemStack(Items.map), Renderable.string("§eUpgrades")) {
+ vTab(
+ ItemStack(Items.map),
+ Renderable.string("§eUpgrades")
+ ) {
currentPage = FortuneGuidePage.UPGRADES
- })
+ }
+ )
horizontalTabs = buildList {
add(
hTab(ItemStack(Blocks.grass), Renderable.string("§eOverview")) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt
index 7b667afaf..349144299 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt
@@ -15,7 +15,8 @@ enum class FortuneStats(
),
CROP_TOTAL(
{ crop -> "§6${crop.niceName.firstLetterUppercase()} Farming Fortune" },
- { "§7§2Farming fortune for this crop" }),
+ { "§7§2Farming fortune for this crop" }
+ ),
ACCESSORY("§2Talisman Bonus", "§7§2Fortune from your talisman\n§2You get 10☘ per talisman tier"),
CROP_UPGRADE("§2Crop Upgrade", "§7§2Fortune from Desk crop upgrades\n§2You get 5☘ per level"),
BASE_TOOL("§2Base tool fortune", "§7§2Crop specific fortune from your tool"),
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt
index cd76262c0..aabee53c8 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt
@@ -90,7 +90,7 @@ object FortuneUpgrades {
private fun getEquipmentUpgrades() {
val visitors = GardenAPI.storage?.uniqueVisitors?.toDouble() ?: 0.0
for (piece in FarmingItems.equip) {
- val item = piece.getItem() ?: return
+ val item = piece.getItem()
// todo tell them to buy the missing item
if (!item.getInternalName().contains("LOTUS")) return
val enchantments = item.getEnchantments() ?: emptyMap()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenPlotMenuHighlighting.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenPlotMenuHighlighting.kt
index af84bd771..3ca75b179 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenPlotMenuHighlighting.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenPlotMenuHighlighting.kt
@@ -29,7 +29,9 @@ object GardenPlotMenuHighlighting {
val list = mutableListOf<PlotStatusType>()
val plot = GardenPlotAPI.plots.find { it.inventorySlot == slot.slotIndex } ?: continue
- val (pestsEnabled, spraysEnabled, locksEnabled, currentEnabled, pastesEnabled) = PlotStatusType.entries.map { it in config.deskPlotStatusTypes }
+ val (pestsEnabled, spraysEnabled, locksEnabled, currentEnabled, pastesEnabled) = PlotStatusType.entries.map {
+ it in config.deskPlotStatusTypes
+ }
if (plot.pests >= 1 && pestsEnabled) list.add(PlotStatusType.PESTS)
if (plot.currentSpray != null && spraysEnabled) list.add(PlotStatusType.SPRAYS)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt
index d8754fd81..690592d52 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt
@@ -157,8 +157,8 @@ object PestFinder {
val isInaccurate = plot.isPestCountInaccurate
val location = playerLocation.copy(x = middle.x, z = middle.z)
event.drawWaypointFilled(location, LorenzColor.RED.toColor())
- val text = "§e" + (if (isInaccurate) "?" else
- pests
+ val text = "§e" + (
+ if (isInaccurate) "?" else pests
) + " §c$pestsName §7in §b$plotName"
event.drawDynamicText(
location, text, 1.5,
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 a413f295a..a3536c196 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
@@ -100,7 +100,8 @@ object HighlightVisitorsOutsideOfGarden {
if (isVisitor(entity) || (entity is EntityArmorStand && isVisitorNearby(entity.getLorenzVec()))) {
event.cancel()
if (packet.action == C02PacketUseEntity.Action.INTERACT) {
- ChatUtils.chatAndOpenConfig("Blocked you from interacting with a visitor. Sneak to bypass or click here to change settings.",
+ ChatUtils.chatAndOpenConfig(
+ "Blocked you from interacting with a visitor. Sneak to bypass or click here to change settings.",
GardenAPI.config.visitors::blockInteracting
)
}
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 e1c5d3f84..f20479b65 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
@@ -352,10 +352,11 @@ private fun getTitleDisplayPair(): List<ScoreboardElementType> {
}
return if (displayConfig.titleAndFooter.useCustomTitle) {
- listOf(displayConfig.titleAndFooter.customTitle.get().toString()
- .replace("&", "§")
- .split("\\n")
- .map { it to alignment }
+ listOf(
+ displayConfig.titleAndFooter.customTitle.get().toString()
+ .replace("&", "§")
+ .split("\\n")
+ .map { it to alignment }
).flatten()
} else {
listOf(ScoreboardData.objectiveTitle to alignment)
@@ -585,15 +586,16 @@ private fun getLobbyDisplayPair(): List<ScoreboardElementType> {
}
private fun getPowerDisplayPair() = listOf(
- (MaxwellAPI.currentPower?.let {
- val mp = if (maxwellConfig.showMagicalPower) "§7(§6${MaxwellAPI.magicalPower?.addSeparators()}§7)" else ""
- if (displayConfig.displayNumbersFirst) {
- "§a${it.replace(" Power", "")} Power $mp"
- } else {
- "Power: §a$it $mp"
- }
- }
- ?: "§cOpen \"Your Bags\"!") to HorizontalAlignment.LEFT,
+ (
+ MaxwellAPI.currentPower?.let {
+ val mp = if (maxwellConfig.showMagicalPower) "§7(§6${MaxwellAPI.magicalPower?.addSeparators()}§7)" else ""
+ if (displayConfig.displayNumbersFirst) {
+ "§a${it.replace(" Power", "")} Power $mp"
+ } else {
+ "Power: §a$it $mp"
+ }
+ } ?: "§cOpen \"Your Bags\"!"
+ ) to HorizontalAlignment.LEFT,
)
private fun getTuningDisplayPair(): List<Pair<String, HorizontalAlignment>> {
@@ -641,10 +643,11 @@ private fun getTuningDisplayPair(): List<Pair<String, HorizontalAlignment>> {
private fun getPowerShowWhen() = !inAnyIsland(IslandType.THE_RIFT)
private fun getCookieDisplayPair() = listOf(
- "§dCookie Buff§f: " + (BitsAPI.cookieBuffTime?.let {
- if (!BitsAPI.hasCookieBuff()) "§cNot Active" else it.timeUntil().format(maxUnits = 2)
- }
- ?: "§cOpen SbMenu!") to HorizontalAlignment.LEFT,
+ "§dCookie Buff§f: " + (
+ BitsAPI.cookieBuffTime?.let {
+ if (!BitsAPI.hasCookieBuff()) "§cNot Active" else it.timeUntil().format(maxUnits = 2)
+ } ?: "§cOpen SbMenu!"
+ ) to HorizontalAlignment.LEFT,
)
private fun getCookieShowWhen(): Boolean {
@@ -852,7 +855,9 @@ private fun getExtraDisplayPair(): List<ScoreboardElementType> {
val lines = recentUnknownLines()
if (lines.isEmpty()) return listOf("<hidden>" to HorizontalAlignment.LEFT)
- return listOf("§cUndetected Lines:" to HorizontalAlignment.LEFT) + lines.map { it.line to HorizontalAlignment.LEFT }
+ return listOf("§cUndetected Lines:" to HorizontalAlignment.LEFT) + lines.map {
+ it.line to HorizontalAlignment.LEFT
+ }
}
private fun getExtraShowWhen(): Boolean = recentUnknownLines().isNotEmpty()
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 3d8251dfb..8dd3af9f7 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
@@ -441,7 +441,8 @@ private fun getBroodmotherLines(): List<String> =
private fun getMiningEventsLines() = buildList {
// Wind
if (getSbLines().any { SbPattern.windCompassPattern.matches(it) } &&
- getSbLines().any { SbPattern.windCompassArrowPattern.matches(it) }) {
+ getSbLines().any { SbPattern.windCompassArrowPattern.matches(it) }
+ ) {
add(getSbLines().first { SbPattern.windCompassPattern.matches(it) })
add("| ${getSbLines().first { SbPattern.windCompassArrowPattern.matches(it) }} §f|")
}
@@ -454,14 +455,16 @@ private fun getMiningEventsLines() = buildList {
// Zone Events
if (getSbLines().any { SbPattern.miningEventPattern.matches(it) } &&
- getSbLines().any { SbPattern.miningEventZonePattern.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) }) {
+ getSbLines().none { SbPattern.miningEventZonePattern.matches(it) }
+ ) {
add(
getSbLines().first { SbPattern.miningEventPattern.matches(it) }
.removePrefix("Event: "),
@@ -470,21 +473,24 @@ private fun getMiningEventsLines() = buildList {
// Mithril Gourmand
if (getSbLines().any { SbPattern.mithrilRemainingPattern.matches(it) } &&
- getSbLines().any { SbPattern.mithrilYourMithrilPattern.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) }) {
+ 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) }) {
+ getSbLines().any { SbPattern.remainingGoblinPattern.matches(it) }
+ ) {
add(getSbLines().first { SbPattern.yourGoblinKillsPattern.matches(it) })
add(getSbLines().first { SbPattern.remainingGoblinPattern.matches(it) })
}
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 43a598839..40eb8c4b3 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
@@ -298,7 +298,11 @@ object ItemDisplayOverlayFeatures {
}
}
- if (BESTIARY_LEVEL.isSelected() && (chestName.contains("Bestiary ➜") || chestName.contains("Fishing ➜")) && lore.any { it.contains("Deaths: ") }) {
+ if (BESTIARY_LEVEL.isSelected() && (chestName.contains("Bestiary ➜") || chestName.contains("Fishing ➜")) &&
+ lore.any {
+ it.contains("Deaths: ")
+ }
+ ) {
lore.matchFirst(bestiaryStackPattern) {
val tier = (group("tier").romanToDecimalIfNecessary() - 1)
return tier.toString()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt
index 8e2a5c592..d89c2aca9 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt
@@ -32,7 +32,7 @@ object ItemStars {
@SubscribeEvent(priority = EventPriority.LOW)
fun onTooltip(event: LorenzToolTipEvent) {
if (!isEnabled()) return
- val stack = event.itemStack ?: return
+ val stack = event.itemStack
if (stack.stackSize != 1) return
val itemName = stack.name
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 517cf4b59..516ee08fd 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/MaxPurseItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/MaxPurseItems.kt
@@ -88,7 +88,8 @@ object MaxPurseItems {
"§7Max items with purse",
"§7Buy order +0.1: §e${buyOrders.addSeparators()}x",
"§7Instant buy: §e${buyInstant.addSeparators()}x"
- ), posLabel = "Max Items With Purse"
+ ),
+ posLabel = "Max Items With Purse"
)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ReforgeHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ReforgeHelper.kt
index 2854b47df..1c098000c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ReforgeHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ReforgeHelper.kt
@@ -288,7 +288,9 @@ object ReforgeHelper {
} else emptyList()
}
- val addedEffect = getReforgeEffect(reforge, itemRarity)?.let { listOf(renderableString(addEffectText)) + it } ?: emptyList()
+ val addedEffect = getReforgeEffect(reforge, itemRarity)?.let {
+ listOf(renderableString(addEffectText)) + it
+ } ?: emptyList()
return listOf(renderableString("§6Reforge Stats")) + stats + removedEffect + addedEffect + click
}
@@ -414,15 +416,17 @@ object ReforgeHelper {
private fun SkyblockStatList.print(appliedReforge: SkyblockStatList? = null): List<Renderable> {
val diff = appliedReforge?.takeIf { config.showDiff }?.let { this - it }
- val main = ((diff ?: this).mapNotNull {
- val key = it.key
- val value = this[key] ?: 0.0
- buildList<Renderable> {
- add(renderableString("§9${value.toStringWithPlus().removeSuffix(".0")}"))
- diff?.get(key)?.let { add(renderableString((if (it < 0) "§c" else "§a") + it.toStringWithPlus().removeSuffix(".0"))) }
- add(renderableString(key.iconWithName))
+ val main = (
+ (diff ?: this).mapNotNull {
+ val key = it.key
+ val value = this[key] ?: 0.0
+ buildList {
+ add(renderableString("§9${value.toStringWithPlus().removeSuffix(".0")}"))
+ diff?.get(key)?.let { add(renderableString((if (it < 0) "§c" else "§a") + it.toStringWithPlus().removeSuffix(".0"))) }
+ add(renderableString(key.iconWithName))
+ }
}
- })
+ )
val table = Renderable.table(main, 5)
return listOf(table)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt
index 1489ba83f..fe1495935 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt
@@ -93,71 +93,73 @@ object SackDisplay {
totalPrice += price
if (rendered >= config.itemToShow) continue
if (stored == 0 && !config.showEmpty) continue
- table[buildList {
- addString(" §7- ")
- addItemStack(internalName)
- // TODO move replace into itemName
- val nameText = Renderable.optionalLink(
- itemName.replace("§k", ""),
- onClick = {
- if (!SackAPI.isTrophySack) {
- BazaarApi.searchForBazaarItem(itemName)
+ table[
+ buildList {
+ addString(" §7- ")
+ addItemStack(internalName)
+ // TODO move replace into itemName
+ val nameText = Renderable.optionalLink(
+ itemName.replace("§k", ""),
+ onClick = {
+ if (!SackAPI.isTrophySack) {
+ BazaarApi.searchForBazaarItem(itemName)
+ }
+ },
+ highlightsOnHoverSlots = listOf(slot)
+ ) { !NEUItems.neuHasFocus() }
+ add(nameText)
+
+
+ when (config.numberFormat) {
+ NumberFormatEntry.DEFAULT -> {
+ addAlignedNumber("$colorCode${stored.addSeparators()}")
+ addString("§7/")
+ addAlignedNumber("§b${total.shortFormat()}")
}
- },
- highlightsOnHoverSlots = listOf(slot)
- ) { !NEUItems.neuHasFocus() }
- add(nameText)
+ NumberFormatEntry.FORMATTED -> {
+ addAlignedNumber("$colorCode${stored.shortFormat()}")
+ addString("§7/")
+ addAlignedNumber("§b${total.shortFormat()}")
+ }
- when (config.numberFormat) {
- NumberFormatEntry.DEFAULT -> {
- addAlignedNumber("$colorCode${stored.addSeparators()}")
- addString("§7/")
- addAlignedNumber("§b${total.shortFormat()}")
- }
-
- NumberFormatEntry.FORMATTED -> {
- addAlignedNumber("$colorCode${stored.shortFormat()}")
- addString("§7/")
- addAlignedNumber("§b${total.shortFormat()}")
- }
-
- NumberFormatEntry.UNFORMATTED -> {
- addAlignedNumber("$colorCode${stored.addSeparators()}")
- addString("§7/")
- addAlignedNumber("§b${total.addSeparators()}")
- }
+ NumberFormatEntry.UNFORMATTED -> {
+ addAlignedNumber("$colorCode${stored.addSeparators()}")
+ addString("§7/")
+ addAlignedNumber("§b${total.addSeparators()}")
+ }
- else -> {
- addAlignedNumber("$colorCode${stored.addSeparators()}")
- addString("§7/")
- addAlignedNumber("§b${total.addSeparators()}")
+ else -> {
+ addAlignedNumber("$colorCode${stored.addSeparators()}")
+ addString("§7/")
+ addAlignedNumber("§b${total.addSeparators()}")
+ }
}
- }
- // TODO change color of amount if full
-// if (colorCode == "§a") addString("§c§l(Full!)")
-
- if (SackAPI.isTrophySack && magmaFish > 0) {
- totalMagmaFish += magmaFish
- add(
- Renderable.hoverTips(
- Renderable.string(
- "§d$magmaFish",
- horizontalAlign = config.alignment
- ),
- listOf(
- "§6Magmafish: §b${magmaFish.addSeparators()}",
- "§6Magmafish value: §b${price / magmaFish}",
- "§6Magmafish per: §b${magmaFish / stored}"
- ),
+ // TODO change color of amount if full
+ // if (colorCode == "§a") addString("§c§l(Full!)")
+
+ if (SackAPI.isTrophySack && magmaFish > 0) {
+ totalMagmaFish += magmaFish
+ add(
+ Renderable.hoverTips(
+ Renderable.string(
+ "§d$magmaFish",
+ horizontalAlign = config.alignment
+ ),
+ listOf(
+ "§6Magmafish: §b${magmaFish.addSeparators()}",
+ "§6Magmafish value: §b${price / magmaFish}",
+ "§6Magmafish per: §b${magmaFish / stored}"
+ ),
+ )
)
- )
- // TODO add cache
- addItemStack("MAGMA_FISH".asInternalName())
+ // TODO add cache
+ addItemStack("MAGMA_FISH".asInternalName())
+ }
+ if (config.showPrice && price != 0L) addAlignedNumber("§6${format(price)}")
}
- if (config.showPrice && price != 0L) addAlignedNumber("§6${format(price)}")
- }] = itemName
+ ] = itemName
rendered++
}
list.add(table.buildSearchableTable())
@@ -187,13 +189,15 @@ object SackDisplay {
val name = SortType.entries[config.sortingType.ordinal].longName // todo avoid ordinal
list.addString("§7Sorted By: §c$name")
- list.addSelector<SortType>(" ",
+ list.addSelector<SortType>(
+ " ",
getName = { type -> type.shortName },
isCurrent = { it.ordinal == config.sortingType.ordinal }, // todo avoid ordinal
onChange = {
config.sortingType = SortingTypeEntry.entries[it.ordinal] // todo avoid ordinals
update(false)
- })
+ }
+ )
list.addButton(
prefix = "§7Number format: ",
@@ -207,13 +211,15 @@ object SackDisplay {
)
if (config.showPrice) {
- list.addSelector<ItemPriceSource>(" ",
+ list.addSelector<ItemPriceSource>(
+ " ",
getName = { type -> type.sellName },
isCurrent = { it.ordinal == config.priceSource.ordinal }, // todo avoid ordinal
onChange = {
config.priceSource = ItemPriceSource.entries[it.ordinal] // todo avoid ordinal
update(false)
- })
+ }
+ )
list.addButton(
prefix = "§7Price Format: ",
getName = PriceFormat.entries[config.priceFormat.ordinal].displayName, // todo avoid ordinal
@@ -234,20 +240,22 @@ object SackDisplay {
val table = mutableMapOf<List<Renderable>, String?>()
for ((name, rune) in sort(SackAPI.runeItem.toList())) {
val (stack, lv1, lv2, lv3) = rune
- table[buildList {
- addString(" §7- ")
- stack?.let { addItemStack(it) }
- add(
- Renderable.optionalLink(
- name,
- onClick = {},
- highlightsOnHoverSlots = listOf(rune.slot)
+ table[
+ buildList {
+ addString(" §7- ")
+ stack?.let { addItemStack(it) }
+ add(
+ Renderable.optionalLink(
+ name,
+ onClick = {},
+ highlightsOnHoverSlots = listOf(rune.slot)
+ )
)
- )
- addAlignedNumber("§e$lv1")
- addAlignedNumber("§e$lv2")
- addAlignedNumber("§e$lv3")
- }] = name
+ addAlignedNumber("§e$lv1")
+ addAlignedNumber("§e$lv2")
+ addAlignedNumber("§e$lv3")
+ }
+ ] = name
}
list.add(table.buildSearchableTable())
}
@@ -259,23 +267,27 @@ object SackDisplay {
val table = mutableMapOf<List<Renderable>, String?>()
for ((name, gem) in sort(SackAPI.gemstoneItem.toList())) {
val (internalName, rough, flawed, fine, roughprice, flawedprice, fineprice) = gem
- table[buildList {
- addString(" §7- ")
- addItemStack(internalName)
- add(Renderable.optionalLink(
- name,
- onClick = {
- BazaarApi.searchForBazaarItem(name.dropLast(1))
- },
- highlightsOnHoverSlots = listOf(gem.slot)
- ) { !NEUItems.neuHasFocus() })
- addAlignedNumber(rough.addSeparators())
- addAlignedNumber("§a${flawed.addSeparators()}")
- addAlignedNumber("§9${fine.addSeparators()}")
- val price = roughprice + flawedprice + fineprice
- totalPrice += price
- if (config.showPrice && price != 0L) addAlignedNumber("§7(§6${format(price)}§7)")
- }] = name
+ table[
+ buildList {
+ addString(" §7- ")
+ addItemStack(internalName)
+ add(
+ Renderable.optionalLink(
+ name,
+ onClick = {
+ BazaarApi.searchForBazaarItem(name.dropLast(1))
+ },
+ highlightsOnHoverSlots = listOf(gem.slot)
+ ) { !NEUItems.neuHasFocus() }
+ )
+ addAlignedNumber(rough.addSeparators())
+ addAlignedNumber("§a${flawed.addSeparators()}")
+ addAlignedNumber("§9${fine.addSeparators()}")
+ val price = roughprice + flawedprice + fineprice
+ totalPrice += price
+ if (config.showPrice && price != 0L) addAlignedNumber("§7(§6${format(price)}§7)")
+ }
+ ] = name
}
list.add(table.buildSearchableTable())
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/SkyblockGuideHighlightFeature.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/SkyblockGuideHighlightFeature.kt
index e0d7e207c..c95950a85 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/SkyblockGuideHighlightFeature.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/SkyblockGuideHighlightFeature.kt
@@ -175,7 +175,9 @@ class SkyblockGuideHighlightFeature private constructor(
"travel",
"Core ➜ Fast Travels Unlocked",
taskOnlyCompleteOncePattern,
- { HypixelCommands.wiki("MUSEUM_TRAVEL_SCROLL") }, // The items do not have proper internal names and using the fact that all travel scrolls lead to the same wiki page
+ {
+ HypixelCommands.wiki("MUSEUM_TRAVEL_SCROLL")
+ }, // The items do not have proper internal names and using the fact that all travel scrolls lead to the same wiki page
openWikiTooltip
)
SkyblockGuideHighlightFeature(
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt
index adc932cce..b5c3c6ab4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt
@@ -79,7 +79,8 @@ object CraftMaterialsFromBazaar {
listOf("§eClick here to buy the items from bazaar!"),
onClick = {
getFromBazaar(neededMaterials)
- })
+ }
+ )
)
}
}
@@ -109,9 +110,14 @@ object CraftMaterialsFromBazaar {
val priceMultiplier = amount * multiplier
val text = "§8${priceMultiplier.addSeparators()}x " + material.itemName +
" §6${(material.getPrice() * priceMultiplier).shortFormat(false)}"
- add(Renderable.optionalLink(text, onClick = {
- BazaarApi.searchForBazaarItem(material, priceMultiplier)
- }))
+ add(
+ Renderable.optionalLink(
+ text,
+ onClick = {
+ BazaarApi.searchForBazaarItem(material, priceMultiplier)
+ }
+ )
+ )
}
add(
Renderable.clickAndHover(
@@ -120,7 +126,8 @@ object CraftMaterialsFromBazaar {
onClick = {
purchasing = false
display = emptyList()
- })
+ }
+ )
)
addMultipliers()
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTooltip.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTooltip.kt
index 88ac9d474..01b42a130 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTooltip.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTooltip.kt
@@ -36,7 +36,7 @@ object ChocolateFactoryTooltip {
if (upgradeInfo.effectiveCost == null) return
event.toolTip.add("§7Extra: §6${upgradeInfo.extraPerSecond?.roundTo(2) ?: "N/A"} §7choc/s")
- event.toolTip.add("§7Effective Cost: §6${upgradeInfo.effectiveCost.addSeparators() ?: "N/A"}")
+ event.toolTip.add("§7Effective Cost: §6${upgradeInfo.effectiveCost.addSeparators()}")
if (slotIndex == ChocolateFactoryAPI.timeTowerIndex) {
event.toolTip.add("§7One charge will give: §6${chocPerTimeTower().addSeparators()}")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/craft/CraftableItemList.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/craft/CraftableItemList.kt
index 8612c9795..517a6fd6d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/craft/CraftableItemList.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/craft/CraftableItemList.kt
@@ -124,7 +124,9 @@ object CraftableItemList {
inInventory = false
}
- private fun pricePer(neededItems: Map<NEUInternalName, Int>): Double = neededItems.map { it.key.getPrice() * it.value }.sum()
+ private fun pricePer(neededItems: Map<NEUInternalName, Int>): Double = neededItems.map {
+ it.key.getPrice() * it.value
+ }.sum()
private fun canCraftAmount(
need: Map<NEUInternalName, Int>,
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/ExperimentationTableAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/ExperimentationTableAPI.kt
index 9fcbbad0b..4965a9883 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/ExperimentationTableAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/ExperimentationTableAPI.kt
@@ -35,7 +35,9 @@ object ExperimentationTableAPI {
fun onInventoryUpdated(event: InventoryUpdatedEvent) {
if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND || !inTable) return
- val entity = EntityUtils.getEntities<EntityArmorStand>().find { it.hasSkullTexture(EXPERIMENTATION_TABLE_SKULL) } ?: return
+ val entity = EntityUtils.getEntities<EntityArmorStand>().find {
+ it.hasSkullTexture(EXPERIMENTATION_TABLE_SKULL)
+ } ?: return
val vec = entity.getLorenzVec()
if (storage?.tablePos != vec) storage?.tablePos = vec
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/SuperpairDataDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/SuperpairDataDisplay.kt
index 37e12aa51..f67c7dcf8 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/SuperpairDataDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/SuperpairDataDisplay.kt
@@ -174,9 +174,9 @@ object SuperpairDataDisplay {
// TODO extract logic in some way
if (it.value.any { data ->
(data.first?.index ?: -1).equalsOneOf(item.index, match.index) ||
- (data.second?.index
- ?: -1).equalsOneOf(item.index, match.index)
- }) {
+ (data.second?.index ?: -1).equalsOneOf(item.index, match.index)
+ }
+ ) {
return
}
}
@@ -199,12 +199,16 @@ object SuperpairDataDisplay {
key.isAnyOf(FoundType.MATCH, FoundType.PAIR) -> {
if (value.any { data ->
item.index.equalsOneOf(data.first?.index ?: -1, data.second?.index ?: -1)
- }) return
+ }
+ ) return
}
- else -> if (value.any { data ->
- (data.item?.index ?: -1) == item.index && data.item?.sameAs(item) == true
- }) return
+ else ->
+ if (
+ value.any { data ->
+ (data.item?.index ?: -1) == item.index && data.item?.sameAs(item) == true
+ }
+ ) return
}
}
@@ -293,7 +297,7 @@ object SuperpairDataDisplay {
slot >= experiment.endSlot ||
(if (experiment.sideSpace == 1) slot in sideSpaces1 else slot in sideSpaces2)
- private fun SuperpairItem?.sameAs(other: SuperpairItem) = this?.reward == other.reward && this?.damage == other.damage
+ private fun SuperpairItem?.sameAs(other: SuperpairItem) = this?.reward == other.reward && this.damage == other.damage
private fun isEnabled() = IslandType.PRIVATE_ISLAND.isInIsland() && config.superpairDisplay
}
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 6c35eb5b1..379d3aa50 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,14 +47,7 @@ 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()
- ?.let { currentRoundRegex.find(it) }
- ?.groups?.get(1)?.value?.toInt() ?: -1) > roundsNeeded)) ||
- (event.inventoryName.contains("Ultrasequencer") &&
- event.inventoryItems.entries
- .filter { it.key < 45 }
- .any { it.value.stackSize > roundsNeeded })
+ isChronomatron(event) || isUltraSequencer(event)
) {
SoundUtils.playBeepSound()
ChatUtils.chat("You have reached the maximum extra Superpairs clicks from this add-on!")
@@ -62,6 +55,22 @@ object SuperpairsClicksAlert {
}
}
+ private fun isChronomatron(event: InventoryOpenEvent) =
+ event.inventoryName.contains("Chronomatron") &&
+ (
+ (
+ event.inventoryItems[4]?.displayName?.removeColor()?.let {
+ currentRoundRegex.find(it)
+ }?.groups?.get(1)?.value?.toInt() ?: -1
+ ) > roundsNeeded
+ )
+
+ private fun isUltraSequencer(event: InventoryUpdatedEvent) =
+ event.inventoryName.contains("Ultrasequencer") &&
+ event.inventoryItems.entries
+ .filter { it.key < 45 }
+ .any { it.value.stackSize > roundsNeeded }
+
@SubscribeEvent
fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
event.move(46, "misc.superpairsClicksAlert", "inventory.helper.enchanting.superpairsClicksAlert")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt
index ad2baedbe..0012ed8b0 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mining/TunnelsMaps.kt
@@ -366,9 +366,11 @@ object TunnelsMaps {
private fun toCompactGemstoneName(it: Map.Entry<String, List<GraphNode>>): Renderable = Renderable.clickAndHover(
Renderable.string(
- (it.key.getFirstColorCode()?.let { "§$it" } ?: "") + ("ROUGH_".plus(
- it.key.removeColor().removeSuffix("stone"),
- ).asInternalName().itemName.takeWhile { it != ' ' }.removeColor()),
+ (it.key.getFirstColorCode()?.let { "§$it" } ?: "") + (
+ "ROUGH_".plus(
+ it.key.removeColor().removeSuffix("stone"),
+ ).asInternalName().itemName.takeWhile { it != ' ' }.removeColor()
+ ),
horizontalAlign = RenderUtils.HorizontalAlignment.CENTER,
),
tips = listOf(it.key),
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseTracker.kt
index 3e81a01a9..bc5e32440 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mining/glacitemineshaft/CorpseTracker.kt
@@ -45,7 +45,11 @@ object CorpseTracker {
}
override fun getDescription(timesGained: Long): List<String> {
- val divisor = 1.coerceAtLeast(getSelectedBucket()?.let { corpsesLooted[it]?.toInt() } ?: corpsesLooted.sumAllValues().toInt())
+ val divisor = 1.coerceAtLeast(
+ getSelectedBucket()?.let {
+ corpsesLooted[it]?.toInt()
+ } ?: corpsesLooted.sumAllValues().toInt()
+ )
val percentage = timesGained.toDouble() / divisor
val dropRate = LorenzUtils.formatPercentage(percentage.coerceAtMost(1.0))
return listOf(
@@ -85,7 +89,9 @@ object CorpseTracker {
if (bucketData.getCorpseCount() == 0L) return@buildList
var profit = tracker.drawItems(bucketData, { true }, this)
- val applicableKeys: List<CorpseType> = bucketData.getSelectedBucket()?.let { listOf(it) } ?: enumValues<CorpseType>().toList()
+ val applicableKeys: List<CorpseType> = bucketData.getSelectedBucket()?.let {
+ listOf(it)
+ } ?: enumValues<CorpseType>().toList()
.filter { bucketData.corpsesLooted[it] != null }
var totalKeyCost = 0.0
var totalKeyCount = 0
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 a0545dc1c..67d54f10b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt
@@ -152,8 +152,8 @@ object MinionXp {
MinionFeatures.minionInventoryOpen -> {
addXpInfoToTooltip(event)
if (collectItem == event.itemStack.item) {
- collectItemXpList.forEachIndexed { i, it ->
- event.toolTip.add(i + 1, it)
+ collectItemXpList.forEachIndexed { i, item ->
+ event.toolTip.add(i + 1, item)
}
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt
index a5062ee1d..7efce2fcd 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt
@@ -260,7 +260,7 @@ object CarryTracker {
val totalCost = customer.carries.sumOf { it.getCost() ?: 0.0 }
val totalCostFormat = formatCost(totalCost)
if (totalCostFormat != "") {
- val paidFormat = "§6${customer.alreadyPaid.shortFormat()}"
+ val paidFormat = "§6${customer.alreadyPaid.shortFormat()}"
val missingFormat = formatCost(totalCost - customer.alreadyPaid)
list.add(
Renderable.clickAndHover(
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 ffc260723..948ae70e0 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt
@@ -157,12 +157,14 @@ object CollectionTracker {
itemAmount.percentWithColorCode(goalAmount, 1)
}§f)"
- display = Collections.singletonList(buildList {
- internalName?.let {
- add(it.getItemStack())
+ display = Collections.singletonList(
+ buildList {
+ internalName?.let {
+ add(it.getItemStack())
+ }
+ add("$itemName collection: §e$format$goal $gainText")
}
- add("$itemName collection: §e$format$goal $gainText")
- })
+ )
}
private fun countCurrentlyInInventory(): Int {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt
index f8e5fbe32..ff5a5f7ac 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt
@@ -28,7 +28,8 @@ object JoinCrystalHollows {
if (message == "§cYou do not have an active Crystal Hollows pass!") {
lastWrongPassTime = System.currentTimeMillis()
if (!IslandType.DWARVEN_MINES.isInIsland()) {
- ChatUtils.clickableChat("Click here to warp to Dwarven Mines!",
+ ChatUtils.clickableChat(
+ "Click here to warp to Dwarven Mines!",
onClick = {
HypixelCommands.warp("mines")
}, "§eClick to run /warp mines!"
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PrivateIslandNoPickaxeAbility.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PrivateIslandNoPickaxeAbility.kt
index dc55af349..093c7d80e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/PrivateIslandNoPickaxeAbility.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PrivateIslandNoPickaxeAbility.kt
@@ -23,7 +23,8 @@ object PrivateIslandNoPickaxeAbility {
if (event.itemInHand?.getItemCategoryOrNull()?.let {
ItemCategory.miningTools.contains(it)
- } == true) {
+ } == true
+ ) {
event.cancel()
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordLocationKey.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordLocationKey.kt
index 895a04688..7f6caba24 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordLocationKey.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordLocationKey.kt
@@ -298,16 +298,12 @@ object DiscordLocationKey {
fun getDiscordIconKey(location: String): String {
val keyIfNormal = location.lowercase().replace(' ', '-')
- return if (normalRPC.contains(keyIfNormal)) {
- keyIfNormal
- } else if (specialRPC.containsKey(location)) {
- specialRPC[location]!!
- } else if (specialNetherRPC.contains(location)) {
- "crimson-isle"
- } else if (specialRiftRPC.containsKey(location)) {
- specialRiftRPC[location]!!
- } else {
- getAmbiguousKey(location) // will return skyblock-logo if not found
+ return when {
+ normalRPC.contains(keyIfNormal) -> keyIfNormal
+ specialRPC.containsKey(location) -> specialRPC[location] ?: getAmbiguousKey(location)
+ specialNetherRPC.contains(location) -> "crimson-isle"
+ specialRiftRPC.containsKey(location) -> specialRiftRPC[location] ?: getAmbiguousKey(location)
+ else -> getAmbiguousKey(location) // will return skyblock-logo if not found
}
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt
index 16843ff6d..29f20fc05 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt
@@ -120,21 +120,23 @@ object DiscordRPCManager : IPCListener {
private fun updatePresence() {
val location = DiscordStatus.LOCATION.getDisplayString()
val discordIconKey = DiscordLocationKey.getDiscordIconKey(location)
- client?.sendRichPresence(RichPresence.Builder().apply {
- setDetails(getStatusByConfigId(config.firstLine.get()).getDisplayString())
- setState(getStatusByConfigId(config.secondLine.get()).getDisplayString())
- setStartTimestamp(startTimestamp)
- setLargeImage(discordIconKey, location)
-
- if (config.showSkyCryptButton.get()) {
- addButton(
- RichPresenceButton(
- "https://sky.shiiyu.moe/stats/${LorenzUtils.getPlayerName()}/${HypixelData.profileName}",
- "Open SkyCrypt"
+ client?.sendRichPresence(
+ RichPresence.Builder().apply {
+ setDetails(getStatusByConfigId(config.firstLine.get()).getDisplayString())
+ setState(getStatusByConfigId(config.secondLine.get()).getDisplayString())
+ setStartTimestamp(startTimestamp)
+ setLargeImage(discordIconKey, location)
+
+ if (config.showSkyCryptButton.get()) {
+ addButton(
+ RichPresenceButton(
+ "https://sky.shiiyu.moe/stats/${LorenzUtils.getPlayerName()}/${HypixelData.profileName}",
+ "Open SkyCrypt"
+ )
)
- )
- }
- }.build())
+ }
+ }.build()
+ )
}
override fun onReady(client: IPCClient) {
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 82be48f80..708704d68 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
@@ -163,7 +163,7 @@ enum class DiscordStatus(private val displayMessageSupplier: (() -> String?)) {
ITEM({
InventoryUtils.getItemInHand()?.let {
- String.format("Holding ${it.displayName.removeColor()}")
+ String.format(java.util.Locale.US, "Holding ${it.displayName.removeColor()}")
} ?: "No item in hand"
}),
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 5797c50cd..fb1ce6b44 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
@@ -133,13 +133,15 @@ 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
@@ -223,7 +225,9 @@ object EstimatedItemValueCalculator {
private fun getPriceOrCompositePriceForAttribute(attributeName: String, level: Int): Double? {
val intRange = if (config.useAttributeComposite.get()) 1..10 else level..level
return intRange.mapNotNull { lowerLevel ->
- "$attributeName;$lowerLevel".asInternalName().getPriceOrNull()?.let { it / (1 shl lowerLevel) * (1 shl level).toDouble() }
+ "$attributeName;$lowerLevel".asInternalName().getPriceOrNull()?.let {
+ it / (1 shl lowerLevel) * (1 shl level).toDouble()
+ }
}.minOrNull()
}
@@ -501,13 +505,13 @@ object EstimatedItemValueCalculator {
val tiers = mutableMapOf<NEUInternalName, Int>()
- for ((id, prices) in EssenceItemUtils.itemPrices) {
+ for ((id, _) in EssenceItemUtils.itemPrices) {
if (!id.contains(removed)) continue
tiers[id] = getKuudraTier(id)
}
- for ((id, tier) in tiers.sorted()) {
- val prices = EssenceItemUtils.itemPrices[id]!!
+ for ((id, _) in tiers.sorted()) {
+ val prices = EssenceItemUtils.itemPrices[id] ?: emptyMap()
maxStars += prices.size
if (remainingStars <= 0) continue
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantsJson.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantsJson.kt
index 99fb0b328..6e1550a97 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantsJson.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantsJson.kt
@@ -2,22 +2,26 @@ package at.hannibal2.skyhanni.features.misc.items.enchants
import at.hannibal2.skyhanni.features.misc.items.enchants.EnchantParser.enchantmentPattern
import com.google.gson.annotations.Expose
+import com.google.gson.annotations.SerializedName
class EnchantsJson {
@Expose
- var NORMAL: HashMap<String, Enchant.Normal> = hashMapOf()
+ @SerializedName("NORMAL")
+ var normal: HashMap<String, Enchant.Normal> = hashMapOf()
@Expose
- var ULTIMATE: HashMap<String, Enchant.Ultimate> = hashMapOf()
+ @SerializedName("ULTIMATE")
+ var ultimate: HashMap<String, Enchant.Ultimate> = hashMapOf()
@Expose
- var STACKING: HashMap<String, Enchant.Stacking> = hashMapOf()
+ @SerializedName("STACKING")
+ var stacking: HashMap<String, Enchant.Stacking> = hashMapOf()
fun getFromLore(passedLoreName: String): Enchant {
val loreName = passedLoreName.lowercase()
- var enchant: Enchant? = NORMAL[loreName]
- if (enchant == null) enchant = ULTIMATE[loreName]
- if (enchant == null) enchant = STACKING[loreName]
+ var enchant: Enchant? = normal[loreName]
+ if (enchant == null) enchant = ultimate[loreName]
+ if (enchant == null) enchant = stacking[loreName]
if (enchant == null) enchant = Enchant.Dummy(passedLoreName)
return enchant
}
@@ -29,13 +33,13 @@ class EnchantsJson {
if (enchants.isNotEmpty()) {
if (enchants.containsKey(enchant.nbtName)) return true
} else {
- if (NORMAL.containsKey(enchant.loreName.lowercase())) return true
- if (ULTIMATE.containsKey(enchant.loreName.lowercase())) return true
- if (STACKING.containsKey(enchant.loreName.lowercase())) return true
+ if (normal.containsKey(enchant.loreName.lowercase())) return true
+ if (ultimate.containsKey(enchant.loreName.lowercase())) return true
+ if (stacking.containsKey(enchant.loreName.lowercase())) return true
}
}
return false
}
- fun hasEnchantData() = NORMAL.isNotEmpty() && ULTIMATE.isNotEmpty() && STACKING.isNotEmpty()
+ fun hasEnchantData() = normal.isNotEmpty() && ultimate.isNotEmpty() && stacking.isNotEmpty()
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboTimeTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboTimeTracker.kt
index bfb8ce715..120c53e47 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboTimeTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboTimeTracker.kt
@@ -144,8 +144,11 @@ object LimboTimeTracker {
fun printStats(onlyPlaytime: Boolean = false) {
val timeInLimbo: Int = if (inLimbo) limboJoinTime.passedSince().inWholeSeconds.toInt() else 0
- val playtime: Int = if (inLimbo) (storage?.playtime
- ?: 0) + limboJoinTime.passedSince().inWholeSeconds.toInt() else storage?.playtime ?: 0
+ val playtime: Int = if (inLimbo) (
+ storage?.playtime ?: 0
+ ) + limboJoinTime.passedSince().inWholeSeconds.toInt()
+ else storage?.playtime ?: 0
+
if (onlyPlaytime) {
ChatUtils.chat("§aYou have ${playtime / 3600} hours and ${playtime % 3600 / 60} minutes playtime!", false)
} else {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigFeatures.kt
index f87146a6f..745928cee 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigFeatures.kt
@@ -76,8 +76,8 @@ object DefaultConfigFeatures {
return
}
optionList = optionList
- .mapValues { it ->
- it.value.filter {
+ .mapValues { option ->
+ option.value.filter {
(togglesInNewVersion == null || it.path in togglesInNewVersion) &&
(togglesInOldVersion == null || it.path !in togglesInOldVersion)
}
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 1ebbaed68..38ba952d5 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
@@ -107,19 +107,25 @@ class DefaultConfigOptionGui(
button("Turn all on", listOf()) {
for (entry in resetSuggestionState.entries) {
entry.setValue(ResetSuggestionState.TURN_ALL_ON)
- orderedOptions[entry.key]!!.forEach { it.toggleOverride = null }
+ orderedOptions[entry.key]?.let { opts ->
+ opts.forEach { it.toggleOverride = null }
+ }
}
}
button("Turn all off", listOf()) {
for (entry in resetSuggestionState.entries) {
entry.setValue(ResetSuggestionState.TURN_ALL_OFF)
- orderedOptions[entry.key]!!.forEach { it.toggleOverride = null }
+ orderedOptions[entry.key]?.let { opts ->
+ opts.forEach { it.toggleOverride = null }
+ }
}
}
button("Leave all untouched", listOf()) {
for (entry in resetSuggestionState.entries) {
entry.setValue(ResetSuggestionState.LEAVE_DEFAULTS)
- orderedOptions[entry.key]!!.forEach { it.toggleOverride = null }
+ orderedOptions[entry.key]?.let { opts ->
+ opts.forEach { it.toggleOverride = null }
+ }
}
}
button("Cancel", listOf()) {
@@ -165,12 +171,16 @@ class DefaultConfigOptionGui(
hoveringTextToDraw = listOf(
"§e${cat.name}",
"§7${cat.description}",
- ) + orderedOptions[cat]!!.map { "§7 - §a" + it.name }
+ ) + orderedOptions[cat]?.let { opts ->
+ opts.map { "§7 - §a" + it.name }
+ }.orEmpty()
}
if (shouldClick) {
resetSuggestionState[cat] = suggestionState.next
- orderedOptions[cat]!!.forEach { it.toggleOverride = null }
+ orderedOptions[cat]?.let { opts ->
+ opts.forEach { it.toggleOverride = null }
+ }
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt
index 98b2d52a0..c555ec6d2 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt
@@ -30,7 +30,8 @@ object AshfangNextResetCooldown {
if (EntityUtils.getEntities<EntityArmorStand>().any {
it.posY > 145 && (it.name.contains("§c§9Ashfang Acolyte§r") || it.name.contains("§c§cAshfang Underling§r"))
- }) {
+ }
+ ) {
spawnTime = SimpleTimeMark.now()
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAPI.kt
index 48fa8d03f..af82198bf 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftAPI.kt
@@ -21,7 +21,7 @@ object RiftAPI {
val farmingTool by lazy { "FARMING_WAND".asInternalName() }
- private val blowgun by lazy { "BERBERIS_BLOWGUN".asInternalName() }
+ private val blowgun by lazy { "BERBERIS_BLOWGUN".asInternalName() }
val ItemStack?.isBlowgun: Boolean
get() = this?.getInternalName() == blowgun
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 50887554d..6b94919ee 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
@@ -56,7 +56,8 @@ object VoltHighlighter {
if (config.voltMoodMeter)
RenderLivingEntityHelper.setEntityColorWithNoHurtTime(
- entity, when (state) {
+ entity,
+ when (state) {
VoltState.FRIENDLY -> 0x8000FF00.toInt()
VoltState.DOING_LIGHTNING -> 0x800000FF.toInt()
VoltState.HOSTILE -> 0x80FF0000.toInt()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/WoodenButtonsHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/WoodenButtonsHelper.kt
index 92e6c2014..516ecfd90 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/WoodenButtonsHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/WoodenButtonsHelper.kt
@@ -131,7 +131,8 @@ object WoodenButtonsHelper {
blockState.getValue(BlockButtonWood.POWERED) == true &&
buttonLocation.canBeSeen(1..3) &&
lastHitButton != buttonLocation &&
- !hitButtons.contains(buttonLocation)) {
+ !hitButtons.contains(buttonLocation)
+ ) {
lastHitButton = buttonLocation
addLastHitButton()
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingMetalSuitProgress.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingMetalSuitProgress.kt
index 9c65a273e..913cfc4bf 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingMetalSuitProgress.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingMetalSuitProgress.kt
@@ -46,14 +46,18 @@ object LivingMetalSuitProgress {
if (config.compactWhenMaxed && isMaxed) return@buildList
for ((stack, progress) in progressMap.entries.reversed()) {
- add(buildList {
- add(" §7- ")
- add(stack)
- add("${stack.displayName}: ")
- add(progress?.let {
- drawProgressBar(progress) + " §b${LorenzUtils.formatPercentage(progress)}"
- } ?: "§cStart upgrading it!")
- })
+ add(
+ buildList {
+ add(" §7- ")
+ add(stack)
+ add("${stack.displayName}: ")
+ add(
+ progress?.let {
+ drawProgressBar(progress) + " §b${LorenzUtils.formatPercentage(progress)}"
+ } ?: "§cStart upgrading it!"
+ )
+ }
+ )
}
}
@@ -63,9 +67,12 @@ object LivingMetalSuitProgress {
val old = progressMap
progressMap = buildMap {
for (armor in InventoryUtils.getArmor().filterNotNull()) {
- put(armor, armor.getLivingMetalProgress()?.toDouble()?.let {
- it.coerceAtMost(100.0) / 100
- })
+ put(
+ armor,
+ armor.getLivingMetalProgress()?.toDouble()?.let {
+ it.coerceAtMost(100.0) / 100
+ }
+ )
}
}
if (old != progressMap) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt
index ccb432f61..11de17b14 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt
@@ -90,7 +90,7 @@ object RiftBloodEffigies {
val split = hearts.split("§").drop(1)
for ((index, s) in split.withIndex()) {
- val time = effigiesTimes[index]!!
+ val time = effigiesTimes[index] ?: continue
if (time.isInPast()) {
if (s == "7") {
@@ -131,7 +131,7 @@ object RiftBloodEffigies {
for ((index, location) in locations.withIndex()) {
val name = "Effigy #${index + 1}"
- val duration = effigiesTimes[index]!!
+ val duration = effigiesTimes[index] ?: continue
if (duration.isFarPast()) {
if (config.unknownTime) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt
index 6fadfce8f..86ae6d096 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt
@@ -124,7 +124,8 @@ object EnigmaSoulWaypoints {
it,
"$name Enigma Soul",
config.color.toChromaColor(),
- condition = { config.showPathFinder })
+ condition = { config.showPathFinder }
+ )
}
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt
index 50ce7f2dc..022a808d0 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt
@@ -134,29 +134,31 @@ object ShowMotesNpcSellPrice {
val sorted = itemMap.toList().sortedByDescending { it.second.second }.toMap().toMutableMap()
for ((internalName, pair) in sorted) {
- newDisplay.add(buildList {
- val (index, value) = pair
- add(" §7- ")
- val stack = internalName.getItemStack()
- add(stack)
- val price = value.formatPrice()
- val valuePer = stack.motesNpcPrice() ?: continue
- val tips = buildList {
- add("§6Item: ${stack.displayName}")
- add("§6Value per: §d$valuePer Motes")
- add("§6Total in chest: §d${(value / valuePer).toInt()}")
- add("")
- add("§6Total value: §d$price coins")
- }
- add(
- Renderable.hoverTips(
- "§6${stack.displayName}: §b$price",
- tips,
- highlightsOnHoverSlots = index,
- stack = stack
+ newDisplay.add(
+ buildList {
+ val (index, value) = pair
+ add(" §7- ")
+ val stack = internalName.getItemStack()
+ add(stack)
+ val price = value.formatPrice()
+ val valuePer = stack.motesNpcPrice() ?: continue
+ val tips = buildList {
+ add("§6Item: ${stack.displayName}")
+ add("§6Value per: §d$valuePer Motes")
+ add("§6Total in chest: §d${(value / valuePer).toInt()}")
+ add("")
+ add("§6Total value: §d$price coins")
+ }
+ add(
+ Renderable.hoverTips(
+ "§6${stack.displayName}: §b$price",
+ tips,
+ highlightsOnHoverSlots = index,
+ stack = stack
+ )
)
- )
- })
+ }
+ )
}
val total = itemMap.values.fold(0.0) { acc, pair -> acc + pair.second }.formatPrice()
newDisplay.addAsSingletonList("§7Total price: §b$total")
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 9a01a9729..ffee3eda4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt
@@ -297,16 +297,19 @@ object SkillProgress {
add("§6Total XP: §b${totalXp.addSeparators()}")
}
val nameColor = if (skill == activeSkill) "§2" else "§a"
- Renderable.hoverTips(buildString {
- append("$nameColor${skill.displayName} $level ")
- append("§7(")
- append("§b${currentXp.addSeparators()}")
- if (currentXpMax != 0L) {
- append("§6/")
- append("§b${currentXpMax.addSeparators()}")
- }
- append("§7)")
- }, tips)
+ Renderable.hoverTips(
+ buildString {
+ append("$nameColor${skill.displayName} $level ")
+ append("§7(")
+ append("§b${currentXp.addSeparators()}")
+ if (currentXpMax != 0L) {
+ append("§6/")
+ append("§b${currentXpMax.addSeparators()}")
+ }
+ append("§7)")
+ },
+ tips
+ )
}
}
}
@@ -376,7 +379,8 @@ object SkillProgress {
val session = xpInfo.timeActive.seconds.format(TimeUnit.HOUR)
add(
- Renderable.clickAndHover("§7Session: §e$session ${if (xpInfo.sessionTimerActive) "" else "§c(PAUSED)"}",
+ Renderable.clickAndHover(
+ "§7Session: §e$session ${if (xpInfo.sessionTimerActive) "" else "§c(PAUSED)"}",
listOf("§eClick to reset!"),
onClick = {
xpInfo.sessionTimerActive = false
@@ -421,45 +425,49 @@ object SkillProgress {
add(Renderable.itemStack(activeSkill.item, 1.0))
}
- add(Renderable.string(buildString {
- append("§b+${skill.lastGain} ")
-
- if (config.useSkillName.get())
- append("${activeSkill.displayName} ")
-
- val (barCurrent, barMax) =
- if (useCustomGoalLevel && customGoalConfig.enableInProgressBar)
- Pair(have, need)
- else if (config.overflowConfig.enableInProgressBar.get())
- Pair(skill.overflowCurrentXp, skill.overflowCurrentXpMax)
- else
- Pair(skill.currentXp, skill.currentXpMax)
-
- val barPercent = if (barMax == 0L) 100F else 100F * barCurrent / barMax
- skillExpPercentage = (barPercent.toDouble() / 100)
-
- val percent = if (currentXpMax == 0L) 100F else 100F * currentXp / currentXpMax
-
- if (config.usePercentage.get())
- append("§7(§6${percent.roundTo(2)}%§7)")
- else {
- if (currentXpMax == 0L)
- append("§7(§6${currentXp.addSeparators()}§7)")
- else
- append("§7(§6${currentXp.addSeparators()}§7/§6${currentXpMax.addSeparators()}§7)")
- }
+ add(
+ Renderable.string(
+ buildString {
+ append("§b+${skill.lastGain} ")
+
+ if (config.useSkillName.get())
+ append("${activeSkill.displayName} ")
+
+ val (barCurrent, barMax) =
+ if (useCustomGoalLevel && customGoalConfig.enableInProgressBar)
+ Pair(have, need)
+ else if (config.overflowConfig.enableInProgressBar.get())
+ Pair(skill.overflowCurrentXp, skill.overflowCurrentXpMax)
+ else
+ Pair(skill.currentXp, skill.currentXpMax)
+
+ val barPercent = if (barMax == 0L) 100F else 100F * barCurrent / barMax
+ skillExpPercentage = (barPercent.toDouble() / 100)
+
+ val percent = if (currentXpMax == 0L) 100F else 100F * currentXp / currentXpMax
+
+ if (config.usePercentage.get())
+ append("§7(§6${percent.roundTo(2)}%§7)")
+ else {
+ if (currentXpMax == 0L)
+ append("§7(§6${currentXp.addSeparators()}§7)")
+ else
+ append("§7(§6${currentXp.addSeparators()}§7/§6${currentXpMax.addSeparators()}§7)")
+ }
- if (config.showActionLeft.get() && percent != 100f) {
- append(" - ")
- val gain = skill.lastGain.formatDouble()
- val actionLeft = (ceil(currentXpMax.toDouble() - currentXp) / gain).toLong().addSeparators()
- if (skill.lastGain != "" && !actionLeft.contains("-")) {
- append("§6$actionLeft Left")
- } else {
- append("§6∞ Left")
+ if (config.showActionLeft.get() && percent != 100f) {
+ append(" - ")
+ val gain = skill.lastGain.formatDouble()
+ val actionLeft = (ceil(currentXpMax.toDouble() - currentXp) / gain).toLong().addSeparators()
+ if (skill.lastGain != "" && !actionLeft.contains("-")) {
+ append("§6$actionLeft Left")
+ } else {
+ append("§6∞ Left")
+ }
+ }
}
- }
- }))
+ )
+ )
}
private fun updateSkillInfo() {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt
index d2c161eba..cd6e7b2db 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt
@@ -217,7 +217,8 @@ object SlayerRngMeterDisplay {
if (SlayerAPI.latestSlayerCategory.let {
it.endsWith(" I") || it.endsWith(" II")
- }) {
+ }
+ ) {
return ""
}
val latestSlayerCategory = SlayerAPI.latestSlayerCategory
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt
index 72ab05195..dd63fdd96 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt
@@ -81,7 +81,11 @@ object EndermanSlayerFeatures {
}
}
- if (config.highlightNukekebi && entity.inventory.any { it?.getSkullTexture() == NUKEKUBI_SKULL_TEXTURE } && entity !in nukekubiSkulls) {
+ if (config.highlightNukekebi &&
+ entity.inventory.any {
+ it?.getSkullTexture() == NUKEKUBI_SKULL_TEXTURE
+ } && entity !in nukekubiSkulls
+ ) {
nukekubiSkulls.add(entity)
RenderLivingEntityHelper.setEntityColor(
entity,
diff --git a/src/main/java/at/hannibal2/skyhanni/features/stranded/HighlightPlaceableNpcs.kt b/src/main/java/at/hannibal2/skyhanni/features/stranded/HighlightPlaceableNpcs.kt
index 82d57cac6..2f1569654 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/stranded/HighlightPlaceableNpcs.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/stranded/HighlightPlaceableNpcs.kt
@@ -84,9 +84,7 @@ object HighlightPlaceableNpcs {
private fun isPlaceableNpc(lore: List<String>): Boolean {
// Checking if NPC & placeable
- if (lore.isEmpty() ||
- !(clickToSetPattern.matches(lore.last()) ||
- clickToSpawnPattern.matches(lore.last()))) {
+ if (lore.isEmpty() || !(clickToSetPattern.matches(lore.last()) || clickToSpawnPattern.matches(lore.last()))) {
return false
}
diff --git a/src/main/java/at/hannibal2/skyhanni/test/graph/GraphEditor.kt b/src/main/java/at/hannibal2/skyhanni/test/graph/GraphEditor.kt
index e724a8fe6..af5a1ea3c 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/graph/GraphEditor.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/graph/GraphEditor.kt
@@ -260,7 +260,8 @@ object GraphEditor {
}
}
- private fun chatAtDisable() = ChatUtils.clickableChat("Graph Editor is now inactive. §lClick to activate.",
+ private fun chatAtDisable() = ChatUtils.clickableChat(
+ "Graph Editor is now inactive. §lClick to activate.",
GraphEditor::commandIn
)
@@ -530,14 +531,23 @@ object GraphEditor {
private fun compileGraph(): Graph {
prune()
val indexedTable = nodes.mapIndexed { index, node -> node.id to index }.toMap()
- val nodes = nodes.mapIndexed { index, it -> GraphNode(index, it.position, it.name, it.tags.mapNotNull { it.internalName }) }
+ val nodes = nodes.mapIndexed { index, node ->
+ GraphNode(
+ index,
+ node.position,
+ node.name,
+ node.tags.map {
+ it.internalName
+ }
+ )
+ }
val neighbours = GraphEditor.nodes.map { node ->
edges.filter { it.isInEdge(node) }.map { edge ->
val otherNode = if (node == edge.node1) edge.node2 else edge.node1
nodes[indexedTable[otherNode.id]!!] to node.position.distance(otherNode.position)
}.sortedBy { it.second }
}
- nodes.forEachIndexed { index, it -> it.neighbours = neighbours[index].toMap() }
+ nodes.forEachIndexed { index, node -> node.neighbours = neighbours[index].toMap() }
return Graph(nodes)
}
@@ -553,7 +563,7 @@ object GraphEditor {
)
},
)
- val translation = graph.mapIndexed { index, it -> it to nodes[index] }.toMap()
+ val translation = graph.mapIndexed { index, node -> node to nodes[index] }.toMap()
edges.addAll(
graph.map { node ->
node.neighbours.map { GraphingEdge(translation[node]!!, translation[it.key]!!) }
diff --git a/src/main/java/at/hannibal2/skyhanni/test/graph/GraphNodeEditor.kt b/src/main/java/at/hannibal2/skyhanni/test/graph/GraphNodeEditor.kt
index c4f6a3896..8c16b4c67 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/graph/GraphNodeEditor.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/graph/GraphNodeEditor.kt
@@ -179,7 +179,9 @@ object GraphNodeEditor {
)
private fun drawNodeNames(): List<Searchable> = buildList {
- for ((node, distance: Double) in GraphEditor.nodes.map { it to it.position.distanceSqToPlayer() }.sortedBy { it.second }) {
+ for ((node, distance: Double) in GraphEditor.nodes.map {
+ it to it.position.distanceSqToPlayer()
+ }.sortedBy { it.second }) {
if (node.tags.isNotEmpty()) {
if (!node.tags.any { it in tagsToShow }) continue
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/CachedItemData.kt b/src/main/java/at/hannibal2/skyhanni/utils/CachedItemData.kt
index 663281ed1..9480e21e6 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/CachedItemData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/CachedItemData.kt
@@ -32,5 +32,6 @@ data class CachedItemData(
* We can't call the generated no args constructors (or rather we cannot generate that constructor), because inline
* classes are not part of the java-kotlin ABI that is super well supported (especially with default arguments).
*/
+ @Suppress("ForbiddenVoid")
constructor(void: Void?) : this()
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt
index a8941c95a..d600cc403 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt
@@ -129,9 +129,9 @@ object ChatUtils {
val rawText = msgPrefix + message
val text = Text.text(rawText) {
- this.onClick(expireAt, oneTimeClick, onClick)
- this.hover = hover.asComponent()
- }
+ this.onClick(expireAt, oneTimeClick, onClick)
+ this.hover = hover.asComponent()
+ }
if (replaceSameMessage) {
text.send(getUniqueMessageIdForString(rawText))
} else {
@@ -166,12 +166,14 @@ object ChatUtils {
) {
val msgPrefix = if (prefix) prefixColor + CHAT_PREFIX else ""
- chat(Text.text(msgPrefix + message) {
- this.hover = Text.multiline(hover)
- if (command != null) {
- this.command = command
+ chat(
+ Text.text(msgPrefix + message) {
+ this.hover = Text.multiline(hover)
+ if (command != null) {
+ this.command = command
+ }
}
- })
+ )
}
/**
@@ -194,10 +196,12 @@ object ChatUtils {
prefixColor: String = "§e",
) {
val msgPrefix = if (prefix) prefixColor + CHAT_PREFIX else ""
- chat(Text.text(msgPrefix + message) {
- this.url = url
- this.hover = "$prefixColor$hover".asComponent()
- })
+ chat(
+ Text.text(msgPrefix + message) {
+ this.url = url
+ this.hover = "$prefixColor$hover".asComponent()
+ }
+ )
if (autoOpen) OSUtils.openBrowser(url)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt
index ddd072c28..13ce7816d 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt
@@ -32,8 +32,10 @@ object ClipboardUtils {
delay(11)
getClipboard(retries - 1)
} else {
- ErrorManager.logErrorStateWithData("can not read clipboard",
- "clipboard can not be accessed after 20 retries")
+ ErrorManager.logErrorStateWithData(
+ "can not read clipboard",
+ "clipboard can not be accessed after 20 retries"
+ )
null
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt
index 898466ce4..829b69234 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt
@@ -291,8 +291,11 @@ object CollectionUtils {
}
fun takeColumn(start: Int, end: Int, startColumn: Int, endColumn: Int, rowSize: Int = 9) =
- generateSequence(start) { it + 1 }.map { (it / (endColumn - startColumn)) * rowSize + (it % (endColumn - startColumn)) + startColumn }
- .takeWhile { it <= end }
+ generateSequence(start) {
+ it + 1
+ }.map {
+ (it / (endColumn - startColumn)) * rowSize + (it % (endColumn - startColumn)) + startColumn
+ }.takeWhile { it <= end }
fun MutableList<Renderable>.addItemStack(internalName: NEUInternalName) {
addItemStack(internalName.getItemStack())
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ComputerTimeOffset.kt b/src/main/java/at/hannibal2/skyhanni/utils/ComputerTimeOffset.kt
index c0f65645a..59701a38f 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ComputerTimeOffset.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ComputerTimeOffset.kt
@@ -64,7 +64,10 @@ object ComputerTimeOffset {
e, "Failed to get NTP offset",
"server" to ntpServer,
)
- else e.printStackTrace()
+ else {
+ @Suppress("PrintStackTrace")
+ e.printStackTrace()
+ }
null
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt
index 97225369d..3467366c9 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt
@@ -288,17 +288,21 @@ object EntityOutlineRenderer {
private fun shouldRender(camera: ICamera, entity: Entity, vector: LorenzVec): Boolean =
// Only render the view entity when sleeping or in 3rd person mode
if (entity === mc.renderViewEntity &&
- !(mc.renderViewEntity is EntityLivingBase && (mc.renderViewEntity as EntityLivingBase).isPlayerSleeping ||
- mc.gameSettings.thirdPersonView != 0)
+ !(
+ mc.renderViewEntity is EntityLivingBase && (mc.renderViewEntity as EntityLivingBase).isPlayerSleeping ||
+ mc.gameSettings.thirdPersonView != 0
+ )
) {
false
- } else mc.theWorld.isBlockLoaded(BlockPos(entity)) && (mc.renderManager.shouldRender(
- entity,
- camera,
- vector.x,
- vector.y,
- vector.z
- ) || entity.riddenByEntity === mc.thePlayer)
+ } else mc.theWorld.isBlockLoaded(BlockPos(entity)) && (
+ mc.renderManager.shouldRender(
+ entity,
+ camera,
+ vector.x,
+ vector.y,
+ vector.z
+ ) || entity.riddenByEntity === mc.thePlayer
+ )
// Only render if renderManager would render and the world is loaded at the entity
private fun outlineColor(color: Int) {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EssenceItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EssenceItemUtils.kt
index b4b9f30b1..df6116388 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/EssenceItemUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/EssenceItemUtils.kt
@@ -64,7 +64,9 @@ object EssenceItemUtils {
return Pair(collectCoinPrices, collectItemPrices)
}
- private fun split(string: String): Pair<NEUInternalName, Long> = string.split(":").let { it[0].asInternalName() to it[1].toLong() }
+ private fun split(string: String): Pair<NEUInternalName, Long> = string.split(":").let {
+ it[0].asInternalName() to it[1].toLong()
+ }
private fun loadEssencePrices(data: NeuEssenceCostJson): MutableMap<Int, EssencePrice> {
val map = mutableMapOf<Int, EssencePrice>()
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt
index 121b9cce3..68ffd74bc 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt
@@ -132,8 +132,7 @@ object GuiRenderUtils {
// borders
GuiScreen.drawRect(
tooltipX - 3, tooltipY - 3 + 1, tooltipX - 3 + 1, tooltipY + tooltipHeight + 3 - 1, borderColor,
-
- )
+ )
GuiScreen.drawRect(
tooltipX + tooltipTextWidth + 2,
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemNameResolver.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemNameResolver.kt
index e3776308f..d3c9a8e15 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ItemNameResolver.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemNameResolver.kt
@@ -100,9 +100,11 @@ object ItemNameResolver {
UtilsPatterns.enchantmentNamePattern.matchMatcher(enchantmentName) {
val name = group("name").trim { it <= ' ' }
val ultimate = group("format").lowercase().contains("§l")
- ((if (ultimate && name != "Ultimate Wise" && name != "Ultimate Jerry") "ULTIMATE_" else "") +
+ (
+ (if (ultimate && name != "Ultimate Wise" && name != "Ultimate Jerry") "ULTIMATE_" else "") +
turboCheck(name).replace(" ", "_").replace("-", "_").uppercase() +
- ";" + group("level").romanToDecimal())
+ ";" + group("level").romanToDecimal()
+ )
}
private fun turboCheck(text: String): String {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/KSerializable.kt b/src/main/java/at/hannibal2/skyhanni/utils/KSerializable.kt
index ad90ff863..8f40284aa 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/KSerializable.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/KSerializable.kt
@@ -47,7 +47,9 @@ class KotlinTypeAdapterFactory : TypeAdapterFactory {
val extraDataParam = primaryConstructor.parameters
.find { it.findAnnotation<ExtraData>() != null && typeOf<MutableMap<String, JsonElement>>().isSubtypeOf(it.type) }
?.let { param ->
- param to kotlinClass.memberProperties.find { it.name == param.name && it.returnType.isSubtypeOf(typeOf<Map<String, JsonElement>>()) } as KProperty1<Any, Map<String, JsonElement>>
+ param to kotlinClass.memberProperties.find {
+ it.name == param.name && it.returnType.isSubtypeOf(typeOf<Map<String, JsonElement>>())
+ } as KProperty1<Any, Map<String, JsonElement>>
}
val parameterInfos = params.map { param ->
ParameterInfo(
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUInternalName.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUInternalName.kt
index 6d0eb33e5..5ea2ed116 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NEUInternalName.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUInternalName.kt
@@ -62,6 +62,7 @@ class NEUInternalName private constructor(private val internalName: String) {
override fun hashCode(): Int = internalName.hashCode()
+ @Suppress("WrongEqualsTypeParameter")
fun equals(other: String) = internalName == other
fun contains(other: String) = internalName.contains(other)
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
index 309f17f68..39f251340 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
@@ -650,8 +650,11 @@ object RenderUtils {
) {
if (list.isEmpty()) return
- val render =
- list.map { it.map { Renderable.fromAny(it, itemScale = itemScale) ?: throw RuntimeException("Unknown render object: $it") } }
+ val render = list.map { listEntry ->
+ listEntry.map {
+ Renderable.fromAny(it, itemScale = itemScale) ?: throw RuntimeException("Unknown render object: $it")
+ }
+ }
this.renderRenderablesDouble(render, extraSpace, posLabel, true)
}
@@ -1323,11 +1326,11 @@ object RenderUtils {
}
} else {
val pathLines = path.zipWithNext()
- pathLines.forEachIndexed { index, it ->
- val reduce = it.second.minus(it.first).normalize().times(bezierPoint)
+ pathLines.forEachIndexed { index, pathLine ->
+ val reduce = pathLine.second.minus(pathLine.first).normalize().times(bezierPoint)
draw3DLine(
- if (index != 0) it.first + reduce else it.first,
- if (index != pathLines.lastIndex) it.second - reduce else it.second,
+ if (index != 0) pathLine.first + reduce else pathLine.first,
+ if (index != pathLines.lastIndex) pathLine.second - reduce else pathLine.second,
color,
lineWidth,
depth,
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt b/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt
index 270b52038..9a0817494 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt
@@ -74,10 +74,10 @@ object TabListData {
val tabHeader = header.conditionalTransform(noColor, { this.removeColor() }, { this })
val tabFooter = footer.conditionalTransform(noColor, { this.removeColor() }, { this })
- val widgets = TabWidget.entries.filter { it.isActive }
- .joinToString("\n") { "\n${it.name} : \n${it.lines.joinToString("\n")}" }
- val string =
- "Header:\n\n$tabHeader\n\nBody:\n\n${resultList.joinToString("\n")}\n\nFooter:\n\n$tabFooter\n\nWidgets:$widgets"
+ val widgets = TabWidget.entries.filter { it.isActive }
+ .joinToString("\n") { "\n${it.name} : \n${it.lines.joinToString("\n")}" }
+ val string =
+ "Header:\n\n$tabHeader\n\nBody:\n\n${resultList.joinToString("\n")}\n\nFooter:\n\n$tabFooter\n\nWidgets:$widgets"
OSUtils.copyToClipboard(string)
ChatUtils.chat("Tab list copied into the clipboard!")
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt b/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt
index efe1ddf95..2e5079896 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt
@@ -10,13 +10,13 @@ object UtilsPatterns {
private val patternGroup = RepoPattern.group("utils")
/** Examples:
- §d§l§ka§r §d§lMYTHIC ACCESSORY §d§l§ka
- §d§l§ka§r §d§lSHINY MYTHIC DUNGEON CHESTPLATE §d§l§ka
- §c§l§ka§r §c§lVERY SPECIAL HATCESSORY §c§l§ka
- §6§lSHINY LEGENDARY DUNGEON BOOTS
- §6§lLEGENDARY DUNGEON BOOTS
- §5§lEPIC BOOTS
- §f§lCOMMON
+ §d§l§ka§r §d§lMYTHIC ACCESSORY §d§l§ka
+ §d§l§ka§r §d§lSHINY MYTHIC DUNGEON CHESTPLATE §d§l§ka
+ §c§l§ka§r §c§lVERY SPECIAL HATCESSORY §c§l§ka
+ §6§lSHINY LEGENDARY DUNGEON BOOTS
+ §6§lLEGENDARY DUNGEON BOOTS
+ §5§lEPIC BOOTS
+ §f§lCOMMON
**/
val rarityLoreLinePattern by patternGroup.pattern(
"item.lore.rarity.line",
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/chat/Text.kt b/src/main/java/at/hannibal2/skyhanni/utils/chat/Text.kt
index fe7486d0d..df5766bcd 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/chat/Text.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/chat/Text.kt
@@ -22,13 +22,13 @@ object Text {
fun multiline(vararg lines: Any?) = join(*lines, separator = NEWLINE)
fun join(vararg components: Any?, separator: IChatComponent? = null): IChatComponent {
val result = ChatComponentText("")
- components.forEachIndexed { index, it ->
- when (it) {
- is IChatComponent -> result.appendSibling(it)
- is String -> result.appendText(it)
- is List<*> -> result.appendSibling(join(*it.toTypedArray(), separator = separator))
+ components.forEachIndexed { index, component ->
+ when (component) {
+ is IChatComponent -> result.appendSibling(component)
+ is String -> result.appendText(component)
+ is List<*> -> result.appendSibling(join(*component.toTypedArray(), separator = separator))
null -> return@forEachIndexed
- else -> error("Unsupported type: ${it::class.simpleName}")
+ else -> error("Unsupported type: ${component::class.simpleName}")
}
if (index < components.size - 1 && separator != null) {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideTab.kt b/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideTab.kt
index 231402d33..fd199b48a 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideTab.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideTab.kt
@@ -42,24 +42,28 @@ class GuideTab(
private var selectColor = NOT_SELECTED_COLOR
- private val renderable = Renderable.clickAndHover(object : Renderable {
- override val width = this@GuideTab.width
- override val height = this@GuideTab.height
- override val horizontalAlign: HorizontalAlignment = HorizontalAlignment.LEFT
- override val verticalAlign: VerticalAlignment = VerticalAlignment.TOP
+ private val renderable = Renderable.clickAndHover(
+ object : Renderable {
+ override val width = this@GuideTab.width
+ override val height = this@GuideTab.height
+ override val horizontalAlign: HorizontalAlignment = HorizontalAlignment.LEFT
+ override val verticalAlign: VerticalAlignment = VerticalAlignment.TOP
- val itemRender = Renderable.itemStack(
- item, 1.0, horizontalAlign = HorizontalAlignment.CENTER, verticalAlign = VerticalAlignment.CENTER
- )
+ val itemRender = Renderable.itemStack(
+ item, 1.0, horizontalAlign = HorizontalAlignment.CENTER, verticalAlign = VerticalAlignment.CENTER
+ )
- override fun render(posX: Int, posY: Int) {
- Gui.drawRect(0, 0, width, height, selectColor)
- itemRender.renderXYAligned(posX, posY, width, height)
+ override fun render(posX: Int, posY: Int) {
+ Gui.drawRect(0, 0, width, height, selectColor)
+ itemRender.renderXYAligned(posX, posY, width, height)
+ }
+ },
+ listOf(tip),
+ onClick = {
+ click()
+ SoundUtils.playClickSound()
}
- }, listOf(tip), onClick = {
- click()
- SoundUtils.playClickSound()
- })
+ )
fun render(posX: Int, posY: Int) {
renderable.render(posX, posY)
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideTablePage.kt b/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideTablePage.kt
index 85dd5bdda..a0dc51c8b 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideTablePage.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideTablePage.kt
@@ -27,7 +27,8 @@ abstract class GuideTablePage(
yPadding = ySpace
),
Renderable.horizontalContainer(footer, footerSpacing, horizontalAlign = HorizontalAlignment.CENTER)
- ), spacing = ySpace
+ ),
+ spacing = ySpace
)
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/json/FeatureTogglesByDefaultAdapter.kt b/src/main/java/at/hannibal2/skyhanni/utils/json/FeatureTogglesByDefaultAdapter.kt
index 67dc2420c..4cef43e35 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/json/FeatureTogglesByDefaultAdapter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/json/FeatureTogglesByDefaultAdapter.kt
@@ -81,7 +81,8 @@ object FeatureTogglesByDefaultAdapter : TypeAdapterFactory {
if (t.fields.none {
it.isAnnotationPresent(FeatureToggle::class.java) ||
gson.getAdapter(TypeToken.get(getType(type, it))) is Adapter
- }) return null
+ }
+ ) return null
val originalWrite = gson.getDelegateAdapter(this, type)
return Adapter(originalWrite, t as Class<T>, gson, type)
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt
index 5362cc177..94f0bc16e 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt
@@ -564,7 +564,7 @@ interface Renderable {
for ((index, renderable) in row.withIndex()) {
GlStateManager.pushMatrix()
GlStateManager.translate(xOffsets[index].toFloat(), yOffsets[rowIndex].toFloat(), 0F)
- renderable?.renderXYAligned(
+ renderable.renderXYAligned(
posX + xOffsets[index],
posY + yOffsets[rowIndex],
xOffsets[index + 1] - xOffsets[index] - emptySpaceX,
@@ -1140,8 +1140,10 @@ interface Renderable {
renderY += yShift
}
@Suppress("SpacingAroundCurly")
- val range = yOffsets.indexOfFirst { it >= scroll.asInt() }..<(yOffsets.indexOfFirst { it >= end }.takeIf { it > 0 }
- ?: yOffsets.size) - 1
+ val range = yOffsets.indexOfFirst { it >= scroll.asInt() }..<(
+ yOffsets.indexOfFirst { it >= end }.takeIf { it > 0 }
+ ?: yOffsets.size
+ ) - 1
val range2 = if (range.last + 3 <= yOffsets.size && yOffsets[range.last + 2] - yOffsets[range.first] <= height - renderY) {
range.first..range.last() + 1
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderableInventory.kt b/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderableInventory.kt
index 9760ef867..310a0523b 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderableInventory.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderableInventory.kt
@@ -87,15 +87,20 @@ object RenderableInventory {
uvRow.map { uv ->
val uvArray = uv.getUvCoords()
val renderable = if (uv == SlotsUv.CENTER) {
- (items[index]?.let { item ->
- Renderable.itemStack(
- item,
- scale,
- 0,
- 0,
- false,
+ (
+ items[index]?.let { item ->
+ Renderable.itemStack(
+ item,
+ scale,
+ 0,
+ 0,
+ false,
+ )
+ } ?: Renderable.placeholder(
+ (16 * scale).toInt(),
+ (16 * scale).toInt()
)
- } ?: Renderable.placeholder((16 * scale).toInt(), (16 * scale).toInt())).also { index++ }
+ ).also { index++ }
} else Renderable.placeholder(0, 0)
Renderable.drawInsideFixedSizedImage(
renderable,
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderableUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderableUtils.kt
index 64c1d8f86..d71ac51a6 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderableUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderableUtils.kt
@@ -33,10 +33,12 @@ internal object RenderableUtils {
/** Calculates the absolute y position of the rows in a table*/
fun calculateTableYOffsets(content: List<List<Renderable?>>, yPadding: Int) = run {
var buffer = 0
- listOf(0) + (content.takeIf { it.isNotEmpty() }?.map { row ->
- buffer += (row.maxOfOrNull { it?.height ?: 0 } ?: 0) + yPadding
- buffer
- } ?: listOf(yPadding))
+ listOf(0) + (
+ content.takeIf { it.isNotEmpty() }?.map { row ->
+ buffer += (row.maxOfOrNull { it?.height ?: 0 } ?: 0) + yPadding
+ buffer
+ } ?: listOf(yPadding)
+ )
}
fun calculateAlignmentXOffset(width: Int, xSpace: Int, alignment: HorizontalAlignment) = when (alignment) {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/BucketedItemTrackerData.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/BucketedItemTrackerData.kt
index 2197bf5c0..f5aa42056 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/BucketedItemTrackerData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/BucketedItemTrackerData.kt
@@ -59,10 +59,10 @@ abstract class BucketedItemTrackerData<E : Enum<E>> : TrackerData() {
?: (this.javaClass.genericSuperclass as? ParameterizedTypeImpl)?.actualTypeArguments?.firstOrNull()?.let { type ->
(type as? Class<E>)?.enumConstants
} ?: ErrorManager.skyHanniError(
- "Unable to retrieve enum constants for E in BucketedItemTrackerData",
- "selectedBucket" to selectedBucket,
- "dataClass" to this.javaClass.superclass.name,
- )
+ "Unable to retrieve enum constants for E in BucketedItemTrackerData",
+ "selectedBucket" to selectedBucket,
+ "dataClass" to this.javaClass.superclass.name,
+ )
}
@Expose
@@ -71,8 +71,12 @@ abstract class BucketedItemTrackerData<E : Enum<E>> : TrackerData() {
private var bucketedItems: MutableMap<E, MutableMap<NEUInternalName, TrackedItem>> = HashMap()
private fun getBucket(bucket: E): MutableMap<NEUInternalName, TrackedItem> = bucketedItems[bucket]?.toMutableMap() ?: HashMap()
- private fun getPoppedBuckets(): MutableList<E> = (bucketedItems.toMutableMap().filter { it.value.isNotEmpty() }.keys).toMutableList()
- fun getItemsProp(): MutableMap<NEUInternalName, TrackedItem> = getSelectedBucket()?.let { getBucket(it) } ?: flattenBuckets()
+ private fun getPoppedBuckets(): MutableList<E> = bucketedItems.toMutableMap().filter {
+ it.value.isNotEmpty()
+ }.keys.toMutableList()
+ fun getItemsProp(): MutableMap<NEUInternalName, TrackedItem> = getSelectedBucket()?.let {
+ getBucket(it)
+ } ?: flattenBuckets()
fun getSelectedBucket() = selectedBucket
fun selectNextSequentialBucket() {
// Move to the next ordinal, or wrap to null if at the last value
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniBucketedItemTracker.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniBucketedItemTracker.kt
index cd8564634..2addca5c0 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniBucketedItemTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniBucketedItemTracker.kt
@@ -59,9 +59,9 @@ class SkyHanniBucketedItemTracker<E : Enum<E>, BucketedData : BucketedItemTracke
lists.addSearchableSelector<ItemPriceSource>(
"",
getName = { type -> type.sellName },
- isCurrent = { it?.ordinal == config.priceSource.ordinal }, // todo avoid ordinal
+ isCurrent = { it.ordinal == config.priceSource.ordinal }, // todo avoid ordinal
onChange = {
- config.priceSource = it?.let { ItemPriceSource.entries[it.ordinal] } // todo avoid ordinal
+ config.priceSource = it.let { ItemPriceSource.entries[it.ordinal] } // todo avoid ordinal
update()
},
)