Skip to content

Commit dd7e139

Browse files
committed
Tweak editorconfig
1 parent 9bcfa07 commit dd7e139

File tree

11 files changed

+36
-53
lines changed

11 files changed

+36
-53
lines changed

.editorconfig

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
root = true
22

3-
[*.md]
3+
[*.{md}]
44
ktlint_standard = disabled
55

66
[*.{kt,kts}]
77
ktlint_code_style = intellij_idea
8-
max_line_length = 240
8+
max_line_length = 140
99
ij_continuation_indent_size = 4
1010
ij_kotlin_name_count_to_use_star_import = 100
1111
ij_kotlin_name_count_to_use_star_import_for_members = 100
@@ -17,6 +17,13 @@ ktlint_standard_trailing-comma-on-declaration-site = disabled
1717
ktlint_standard_package-name = disabled
1818
ktlint_standard_annotation = disabled
1919
ktlint_standard_property-naming = disabled
20+
ktlint_standard_argument-list-wrapping = disabled
21+
ktlint_standard_parameter-list-wrapping = disabled
22+
ktlint_standard_class-signature = disabled
23+
ktlint_standard_function-expression-body = disabled
24+
ktlint_function_signature_body_expression_wrapping = default
25+
ktlint_class_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than = unset
26+
ktlint_function_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than = unset
2027

2128
[*.{yml,yaml}]
2229
indent_size = 4

interfaces/src/main/kotlin/com/noxcrew/interfaces/InterfacesListeners.kt

+8-14
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
428428
}
429429

430430
/** Returns whether [block] will trigger some interaction if clicked with [item]. */
431-
private fun hasInteraction(block: Block, item: ItemStack): Boolean =
432-
CLICKABLE_BLOCKS.isTagged(block)
431+
private fun hasInteraction(block: Block, item: ItemStack): Boolean = CLICKABLE_BLOCKS.isTagged(block)
433432

434433
@EventHandler(priority = EventPriority.LOW)
435434
public fun onInteract(event: PlayerInteractEvent) {
@@ -582,11 +581,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
582581
}
583582

584583
/** Returns whether [clickedPoint] in [view] can be freely moved. */
585-
private fun canFreelyMove(
586-
view: AbstractInterfaceView<*, *, *>,
587-
clickedPoint: GridPoint,
588-
isPlayerInventory: Boolean
589-
): Boolean {
584+
private fun canFreelyMove(view: AbstractInterfaceView<*, *, *>, clickedPoint: GridPoint, isPlayerInventory: Boolean): Boolean {
590585
// If we don't allow clicking empty slots we never allow freely moving
591586
if (view.builder.preventClickingEmptySlots &&
592587
!(view.builder.allowClickingOwnInventoryIfClickingEmptySlotsIsPrevented && isPlayerInventory)
@@ -678,13 +673,12 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
678673
}
679674

680675
/** Returns whether an inventory interaction from [player] should be throttled. */
681-
private fun shouldThrottle(player: Player): Boolean =
682-
if (spamPrevention.getIfPresent(player.uniqueId) == null) {
683-
spamPrevention.put(player.uniqueId, Unit)
684-
false
685-
} else {
686-
true
687-
}
676+
private fun shouldThrottle(player: Player): Boolean = if (spamPrevention.getIfPresent(player.uniqueId) == null) {
677+
spamPrevention.put(player.uniqueId, Unit)
678+
false
679+
} else {
680+
true
681+
}
688682

689683
/** Starts a new chat query on [view]. */
690684
public fun startChatQuery(

interfaces/src/main/kotlin/com/noxcrew/interfaces/grid/GridBoxGenerator.kt

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ public data class GridBoxGenerator(
1111

1212
public constructor(x1: Int, y1: Int, x2: Int, y2: Int) : this(GridPoint(x1, y1), GridPoint(x2, y2))
1313

14-
override fun iterator(): Iterator<GridPoint> =
15-
(min..max).iterator()
14+
override fun iterator(): Iterator<GridPoint> = (min..max).iterator()
1615

17-
override fun generate(): List<GridPoint> =
18-
(min..max).toList()
16+
override fun generate(): List<GridPoint> = (min..max).toList()
1917
}

interfaces/src/main/kotlin/com/noxcrew/interfaces/grid/GridPoint.kt

+2-4
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,10 @@ public data class GridPoint(val x: Int, val y: Int) {
3131
}
3232

3333
/** Returns a new [GridPoint] equal to this + [other]. */
34-
public operator fun plus(other: GridPoint): GridPoint =
35-
GridPoint(x + other.x, y + other.y)
34+
public operator fun plus(other: GridPoint): GridPoint = GridPoint(x + other.x, y + other.y)
3635

3736
/** Returns a new [GridPoint] equal to this - [other]. */
38-
public operator fun minus(other: GridPoint): GridPoint =
39-
GridPoint(x - other.x, y - other.y)
37+
public operator fun minus(other: GridPoint): GridPoint = GridPoint(x - other.x, y - other.y)
4038

4139
/** Returns a sequence of grid points between this and [other]. */
4240
public operator fun rangeTo(other: GridPoint): Sequence<GridPoint> = sequence {

interfaces/src/main/kotlin/com/noxcrew/interfaces/interfaces/InterfaceProperties.kt

+1-4
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,7 @@ public open class InterfaceProperties<P : Pane> {
7272
public var fillMenuWithAir: Boolean = false
7373

7474
/** Adds a new close handler [closeHandler] that triggers whenever the inventory is closed for any of the given [reasons]. */
75-
public fun addCloseHandler(
76-
reasons: Collection<InventoryCloseEvent.Reason> = DEFAULT_REASONS,
77-
closeHandler: CloseHandler
78-
) {
75+
public fun addCloseHandler(reasons: Collection<InventoryCloseEvent.Reason> = DEFAULT_REASONS, closeHandler: CloseHandler) {
7976
reasons.forEach {
8077
_closeHandlers[it] = closeHandler
8178
}

interfaces/src/main/kotlin/com/noxcrew/interfaces/pane/CompletedPane.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ internal class CompletedOrderedPane(
2222
private val ordering: List<Int>
2323
) : CompletedPane() {
2424

25-
override fun getRaw(vector: GridPoint): CompletedElement? =
26-
ordering.getOrNull(vector.x)?.let { get(it, vector.y) }
25+
override fun getRaw(vector: GridPoint): CompletedElement? = ordering.getOrNull(vector.x)?.let { get(it, vector.y) }
2726
}
2827

2928
/** Completes a pane for [player] by drawing each element while suspending. */

interfaces/src/main/kotlin/com/noxcrew/interfaces/pane/Pane.kt

+4-8
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,14 @@ public open class Pane : GridMap<Element> {
1313

1414
private val gridMap = HashGridMap<Element>()
1515

16-
override fun set(row: Int, column: Int, value: Element): Unit =
17-
gridMap.set(row, column, value)
16+
override fun set(row: Int, column: Int, value: Element): Unit = gridMap.set(row, column, value)
1817

19-
override fun get(row: Int, column: Int): Element? =
20-
gridMap[row, column]
18+
override fun get(row: Int, column: Int): Element? = gridMap[row, column]
2119

22-
override fun has(row: Int, column: Int): Boolean =
23-
gridMap.has(row, column)
20+
override fun has(row: Int, column: Int): Boolean = gridMap.has(row, column)
2421

2522
override suspend fun forEachSuspending(consumer: suspend (row: Int, column: Int, Element) -> Unit): Unit =
2623
gridMap.forEachSuspending(consumer)
2724

28-
override fun forEach(consumer: (row: Int, column: Int, Element) -> Unit): Unit =
29-
gridMap.forEach(consumer)
25+
override fun forEach(consumer: (row: Int, column: Int, Element) -> Unit): Unit = gridMap.forEach(consumer)
3026
}

interfaces/src/main/kotlin/com/noxcrew/interfaces/utilities/BukkitInventoryUtilities.kt

+1-5
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ public fun forEachInGrid(rows: Int, columns: Int, function: (row: Int, column: I
2525
}
2626

2727
/** Creates a new */
28-
public fun createBukkitInventory(
29-
holder: InventoryHolder,
30-
rows: Int,
31-
title: Component?
32-
): Inventory {
28+
public fun createBukkitInventory(holder: InventoryHolder, rows: Int, title: Component?): Inventory {
3329
if (title == null) {
3430
return Bukkit.createInventory(holder, rows * COLUMNS_IN_CHEST)
3531
}

interfaces/src/main/kotlin/com/noxcrew/interfaces/view/AbstractInterfaceView.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ public abstract class AbstractInterfaceView<I : InterfacesInventory, T : Interfa
109109
internal fun markClosed(
110110
coroutineScope: CoroutineScope,
111111
reason: InventoryCloseEvent.Reason = InventoryCloseEvent.Reason.UNKNOWN,
112-
changingView: Boolean = reason == InventoryCloseEvent.Reason.OPEN_NEW
112+
changingView: Boolean = reason ==
113+
InventoryCloseEvent.Reason.OPEN_NEW
113114
) {
114115
if (!changingView) {
115116
// End a possible chat query with the listener (unless we're changing views)

interfaces/src/main/kotlin/com/noxcrew/interfaces/view/InterfaceView.kt

+5-7
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,16 @@ public interface InterfaceView {
4141
/** Closes this view. */
4242
public suspend fun close(
4343
reason: InventoryCloseEvent.Reason = InventoryCloseEvent.Reason.UNKNOWN,
44-
changingView: Boolean = reason == InventoryCloseEvent.Reason.OPEN_NEW
44+
changingView: Boolean = reason ==
45+
InventoryCloseEvent.Reason.OPEN_NEW
4546
): Unit = close(CoroutineScope(coroutineContext), reason, changingView)
4647

4748
/** Closes this view immediately, running any closing handling on [coroutineScope]. */
4849
public fun close(
4950
coroutineScope: CoroutineScope,
5051
reason: InventoryCloseEvent.Reason = InventoryCloseEvent.Reason.UNKNOWN,
51-
changingView: Boolean = reason == InventoryCloseEvent.Reason.OPEN_NEW
52+
changingView: Boolean = reason ==
53+
InventoryCloseEvent.Reason.OPEN_NEW
5254
)
5355

5456
/** Returns whether this view is opened based on the player's current shown inventory. */
@@ -77,9 +79,5 @@ public interface InterfaceView {
7779
*
7880
* Will fail if this view is not open.
7981
*/
80-
public fun runChatQuery(
81-
timeout: Duration = 30.seconds,
82-
onCancel: suspend () -> Unit = {},
83-
onComplete: suspend (Component) -> Boolean
84-
)
82+
public fun runChatQuery(timeout: Duration = 30.seconds, onCancel: suspend () -> Unit = {}, onComplete: suspend (Component) -> Boolean)
8583
}

interfaces/src/main/kotlin/com/noxcrew/interfaces/view/PlayerInterfaceView.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,5 @@ public class PlayerInterfaceView internal constructor(
7070
}
7171
}
7272

73-
override fun isOpen(): Boolean =
74-
InterfacesListeners.INSTANCE.getOpenPlayerInterface(player.uniqueId) == this
73+
override fun isOpen(): Boolean = InterfacesListeners.INSTANCE.getOpenPlayerInterface(player.uniqueId) == this
7574
}

0 commit comments

Comments
 (0)