diff options
author | David Cole <40234707+DavidArthurCole@users.noreply.github.com> | 2024-10-11 12:42:33 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-11 18:42:33 +0200 |
commit | 7c2d4ed566246513bc438272e436627412147d62 (patch) | |
tree | edf8d3d01a49bd7c4f5993bae6367613c32fcaac /src/main/java/at/hannibal2/skyhanni/test | |
parent | 0671e35163d55ab0f940aa6806a0d7bfb2876429 (diff) | |
download | skyhanni-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>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/test')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/test/graph/GraphEditor.kt | 18 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/test/graph/GraphNodeEditor.kt | 4 |
2 files changed, 17 insertions, 5 deletions
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 } |