Skip to content

Commit 88b558f

Browse files
committed
Update and apply Spotless
1 parent fe97f5c commit 88b558f

39 files changed

+76
-77
lines changed

build.gradle.kts

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ subprojects {
3838
kotlin {
3939
ktlint("0.48.2")
4040
}
41-
ratchetFrom("origin/main")
4241
}
4342

4443
// Configure any existing RunServerTasks

examples/src/main/kotlin/com/noxcrew/interfaces/example/CatalogueExampleInterface.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class CatalogueExampleInterface : RegistrableInterface {
1515

1616
withTransform { pane, _ ->
1717
pane[3, 3] = StaticElement(
18-
Drawable.drawable(Material.STICK)
18+
Drawable.drawable(Material.STICK),
1919
) { (player) ->
2020
runBlocking {
2121
ChangingTitleExampleInterface().create().open(player)

examples/src/main/kotlin/com/noxcrew/interfaces/example/ExamplePlugin.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class ExamplePlugin : JavaPlugin(), Listener {
3030
ChangingTitleExampleInterface(),
3131
CatalogueExampleInterface(),
3232
MovingExampleInterface(),
33-
TabbedExampleInterface()
33+
TabbedExampleInterface(),
3434
)
3535
}
3636

@@ -96,7 +96,7 @@ public class ExamplePlugin : JavaPlugin(), Listener {
9696
counter++
9797
},
9898
0,
99-
1
99+
1,
100100
)
101101
}
102102

@@ -108,7 +108,7 @@ public class ExamplePlugin : JavaPlugin(), Listener {
108108
runBlocking {
109109
playerInterface().open(e.player)
110110
}
111-
}
111+
},
112112
)
113113
}
114114

examples/src/main/kotlin/com/noxcrew/interfaces/example/TabbedExampleInterface.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class TabbedExampleInterface : RegistrableInterface {
1414

1515
private companion object {
1616
private val ELEMENT = StaticElement(
17-
drawable(Material.NETHER_STAR)
17+
drawable(Material.NETHER_STAR),
1818
)
1919
}
2020

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public object InterfacesConstants {
3434
- Player: ${player ?: "N/A"} (${player?.let(Bukkit::getPlayer)?.name ?: "offline"})
3535
- Launch reason: $reason
3636
""".trimIndent(),
37-
exception
37+
exception,
3838
)
3939
}
4040
} +
@@ -58,6 +58,6 @@ public object InterfacesConstants {
5858
}
5959
?.asCoroutineDispatcher()
6060
?: Dispatchers.Default
61-
}
61+
},
6262
)
6363
}

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

+22-22
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
7575
Reason.PLUGIN,
7676
Reason.TELEPORT,
7777
Reason.CANT_USE,
78-
Reason.UNLOADED
78+
Reason.UNLOADED,
7979
)
8080

8181
/** An incomplete set of blocks that have some interaction when clicked on. */
@@ -85,7 +85,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
8585
MaterialTags.WOODEN_DOORS,
8686
MaterialTags.WOODEN_TRAPDOORS,
8787
MaterialTags.FENCE_GATES,
88-
MaterialSetTag.BUTTONS
88+
MaterialSetTag.BUTTONS,
8989
)
9090
// Add blocks with inventories
9191
.add(
@@ -100,7 +100,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
100100
Material.LOOM,
101101
Material.CARTOGRAPHY_TABLE,
102102
Material.ENCHANTING_TABLE,
103-
Material.SMITHING_TABLE
103+
Material.SMITHING_TABLE,
104104
)
105105
.add(Material.LEVER)
106106
.add(Material.CAKE)
@@ -109,25 +109,25 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
109109
Material.COPPER_DOOR,
110110
Material.EXPOSED_COPPER_DOOR,
111111
Material.WEATHERED_COPPER_DOOR,
112-
Material.OXIDIZED_COPPER_DOOR
112+
Material.OXIDIZED_COPPER_DOOR,
113113
)
114114
.add(
115115
Material.WAXED_COPPER_DOOR,
116116
Material.WAXED_EXPOSED_COPPER_DOOR,
117117
Material.WAXED_WEATHERED_COPPER_DOOR,
118-
Material.WAXED_OXIDIZED_COPPER_DOOR
118+
Material.WAXED_OXIDIZED_COPPER_DOOR,
119119
)
120120
.add(
121121
Material.COPPER_TRAPDOOR,
122122
Material.EXPOSED_COPPER_TRAPDOOR,
123123
Material.WEATHERED_COPPER_TRAPDOOR,
124-
Material.OXIDIZED_COPPER_TRAPDOOR
124+
Material.OXIDIZED_COPPER_TRAPDOOR,
125125
)
126126
.add(
127127
Material.WAXED_COPPER_TRAPDOOR,
128128
Material.WAXED_EXPOSED_COPPER_TRAPDOOR,
129129
Material.WAXED_WEATHERED_COPPER_TRAPDOOR,
130-
Material.WAXED_OXIDIZED_COPPER_TRAPDOOR
130+
Material.WAXED_OXIDIZED_COPPER_TRAPDOOR,
131131
)
132132
// You can click signs to edit them
133133
.add(MaterialTags.SIGNS)
@@ -138,7 +138,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
138138
val view: InterfaceView,
139139
val onCancel: suspend () -> Unit,
140140
val onComplete: suspend (Component) -> Boolean,
141-
val id: UUID
141+
val id: UUID,
142142
)
143143

144144
/** The view currently being opened. */
@@ -313,7 +313,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
313313
if (event.click == ClickType.NUMBER_KEY && !canFreelyMove(
314314
view,
315315
view.backing.relativizePlayerInventorySlot(GridPoint.at(3, event.hotbarButton)),
316-
true
316+
true,
317317
)
318318
) {
319319
event.isCancelled = true
@@ -324,7 +324,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
324324
if (event.click == ClickType.SWAP_OFFHAND && !canFreelyMove(
325325
view,
326326
view.backing.relativizePlayerInventorySlot(GridPoint.at(4, 4)),
327-
true
327+
true,
328328
)
329329
) {
330330
event.isCancelled = true
@@ -347,7 +347,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
347347
it != null && it.isSimilar(clickedItem) && !canFreelyMove(
348348
view,
349349
requireNotNull(GridPoint.fromBukkitChestSlot(index)),
350-
false
350+
false,
351351
)
352352
}
353353
) ||
@@ -357,9 +357,9 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
357357
!canFreelyMove(
358358
view,
359359
view.backing.relativizePlayerInventorySlot(
360-
requireNotNull(GridPoint.fromBukkitPlayerSlot(index))
360+
requireNotNull(GridPoint.fromBukkitPlayerSlot(index)),
361361
),
362-
true
362+
true,
363363
)
364364
}
365365
) {
@@ -392,7 +392,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
392392
} else {
393393
targetSlot
394394
},
395-
isMovingIntoPlayerInventory
395+
isMovingIntoPlayerInventory,
396396
)
397397
) {
398398
event.isCancelled = true
@@ -451,7 +451,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
451451
GridPoint.at(3, player.inventory.heldItemSlot)
452452
} else {
453453
PlayerPane.OFF_HAND_SLOT
454-
}
454+
},
455455
)
456456
val click = convertAction(event.action, player.isSneaking)
457457

@@ -585,7 +585,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
585585
private fun canFreelyMove(
586586
view: AbstractInterfaceView<*, *, *>,
587587
clickedPoint: GridPoint,
588-
isPlayerInventory: Boolean
588+
isPlayerInventory: Boolean,
589589
): Boolean {
590590
// If we don't allow clicking empty slots we never allow freely moving
591591
if (view.builder.preventClickingEmptySlots &&
@@ -608,7 +608,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
608608
click: ClickType,
609609
slot: Int,
610610
isPlayerInventory: Boolean,
611-
interact: Boolean
611+
interact: Boolean,
612612
): Boolean {
613613
// Determine the type of click, if nothing was clicked we allow it
614614
val raw = view.completedPane?.getRaw(clickedPoint)
@@ -653,7 +653,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
653653
Bukkit.getScheduler().runTaskLaterAsynchronously(
654654
plugin,
655655
Runnable { completedClickHandler.cancel() },
656-
120
656+
120,
657657
)
658658
}
659659

@@ -691,7 +691,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
691691
view: InterfaceView,
692692
timeout: Duration,
693693
onCancel: suspend () -> Unit,
694-
onComplete: suspend (Component) -> Boolean
694+
onComplete: suspend (Component) -> Boolean,
695695
) {
696696
// Determine if the player has this inventory open
697697
if (!view.isOpen()) return
@@ -721,8 +721,8 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
721721
view,
722722
onCancel,
723723
onComplete,
724-
id
725-
)
724+
id,
725+
),
726726
)
727727

728728
// Set a timer for to automatically cancel this query to prevent players
@@ -740,7 +740,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
740740
view.reopen()
741741
}
742742
},
743-
timeout.inWholeMilliseconds / 50
743+
timeout.inWholeMilliseconds / 50,
744744
)
745745
}
746746

interfaces/src/main/kotlin/com/noxcrew/interfaces/click/ClickContext.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ public data class ClickContext(
1515
/** The hot bar slot pressed between 0-8 if [type] is [ClickType.NUMBER_KEY], or `-1` otherwise. */
1616
public val slot: Int,
1717
/** Whether the click was fired from an interact event (not from an open inventory). */
18-
public val interact: Boolean
18+
public val interact: Boolean,
1919
)

interfaces/src/main/kotlin/com/noxcrew/interfaces/element/CompletedElement.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import org.bukkit.inventory.ItemStack
77
/** A drawn element that includes an [itemStack] to show and a [clickHandler] to run. */
88
public data class CompletedElement(
99
public val itemStack: ItemStack?,
10-
public val clickHandler: ClickHandler
10+
public val clickHandler: ClickHandler,
1111
)
1212

1313
/** Completes drawing this element for [player]. */
1414
public suspend fun Element.complete(player: Player): CompletedElement = CompletedElement(
1515
drawable().draw(player),
16-
clickHandler()
16+
clickHandler(),
1717
)

interfaces/src/main/kotlin/com/noxcrew/interfaces/element/StaticElement.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import com.noxcrew.interfaces.drawable.Drawable
66
/** A static element that uses [drawable] and a set [clickHandler]. */
77
public class StaticElement(
88
private val drawable: Drawable,
9-
private val clickHandler: ClickHandler = ClickHandler.EMPTY
9+
private val clickHandler: ClickHandler = ClickHandler.EMPTY,
1010
) : Element {
1111

1212
override fun drawable(): Drawable = drawable

interfaces/src/main/kotlin/com/noxcrew/interfaces/event/DrawPaneEvent.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class DrawPaneEvent(
1313
/** Whether any slots in the regular inventory were drawn. */
1414
public val isRegularInventory: Boolean,
1515
/** Whether any slots in the player inventory were drawn. */
16-
public val isPlayerInventory: Boolean
16+
public val isPlayerInventory: Boolean,
1717
) : PlayerEvent(player) {
1818

1919
public companion object {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public data class ChainGridPositionGenerator(
55
/** The first generator. */
66
private val first: GridPositionGenerator,
77
/** The second generator. */
8-
private val second: GridPositionGenerator
8+
private val second: GridPositionGenerator,
99
) : GridPositionGenerator {
1010

1111
public companion object {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package com.noxcrew.interfaces.grid
66
*/
77
public data class GridBoxGenerator(
88
private val min: GridPoint,
9-
private val max: GridPoint
9+
private val max: GridPoint,
1010
) : GridPositionGenerator {
1111

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

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package com.noxcrew.interfaces.grid
33
/** An implementation of [GridMap] based by a nested [MutableMap]. */
44
public class HashGridMap<V>(
55
private val backing: MutableMap<Int, MutableMap<Int, V>> = mutableMapOf(),
6-
private val innerConstructor: () -> MutableMap<Int, V> = { mutableMapOf() }
6+
private val innerConstructor: () -> MutableMap<Int, V> = { mutableMapOf() },
77
) : GridMap<V> {
88

99
override fun set(row: Int, column: Int, value: V) {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import org.bukkit.entity.Player
1010
public class ChestInterface internal constructor(
1111
override val rows: Int,
1212
override val initialTitle: Component?,
13-
override val builder: ChestInterfaceBuilder
13+
override val builder: ChestInterfaceBuilder,
1414
) : Interface<ChestInterface, Pane>, TitledInterface {
1515

1616
public companion object {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ public class ChestInterfaceBuilder :
1616
override fun build(): ChestInterface = ChestInterface(
1717
rows,
1818
initialTitle,
19-
this
19+
this,
2020
)
2121
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import org.bukkit.entity.Player
1010
public class CombinedInterface internal constructor(
1111
override val rows: Int,
1212
override val initialTitle: Component?,
13-
override val builder: CombinedInterfaceBuilder
13+
override val builder: CombinedInterfaceBuilder,
1414
) : Interface<CombinedInterface, CombinedPane>, TitledInterface {
1515

1616
public companion object {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ public class CombinedInterfaceBuilder :
1616
override fun build(): CombinedInterface = CombinedInterface(
1717
rows,
1818
initialTitle,
19-
this
19+
this,
2020
)
2121
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public interface Interface<I : Interface<I, P>, P : Pane> {
3232
public suspend fun open(
3333
player: Player,
3434
parent: InterfaceView? =
35-
InterfacesListeners.INSTANCE.convertHolderToInterfaceView(player.openInventory.topInventory.holder)
35+
InterfacesListeners.INSTANCE.convertHolderToInterfaceView(player.openInventory.topInventory.holder),
3636
): InterfaceView
3737

3838
/** Returns the [gridPoint] relative to the player's inventory within this inventory. */

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public open class InterfaceProperties<P : Pane> {
7474
/** Adds a new close handler [closeHandler] that triggers whenever the inventory is closed for any of the given [reasons]. */
7575
public fun addCloseHandler(
7676
reasons: Collection<InventoryCloseEvent.Reason> = DEFAULT_REASONS,
77-
closeHandler: CloseHandler
77+
closeHandler: CloseHandler,
7878
) {
7979
reasons.forEach {
8080
_closeHandlers[it] = closeHandler

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import org.bukkit.entity.Player
77

88
/** An interface that uses the entire player inventory. */
99
public class PlayerInterface internal constructor(
10-
override val builder: PlayerInterfaceBuilder
10+
override val builder: PlayerInterfaceBuilder,
1111
) : Interface<PlayerInterface, PlayerPane> {
1212

1313
public companion object {

interfaces/src/main/kotlin/com/noxcrew/interfaces/inventory/ChestInterfacesInventory.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import org.bukkit.inventory.ItemStack
1111
public class ChestInterfacesInventory(
1212
holder: InventoryHolder,
1313
title: Component?,
14-
rows: Int
14+
rows: Int,
1515
) : CachedInterfacesInventory() {
1616

1717
/** The [chestInventory] being used to place items in. */

interfaces/src/main/kotlin/com/noxcrew/interfaces/inventory/CombinedInterfacesInventory.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class CombinedInterfacesInventory(
1515
holder: InventoryHolder,
1616
player: Player,
1717
title: Component?,
18-
private val rows: Int
18+
private val rows: Int,
1919
) : CachedInterfacesInventory() {
2020

2121
private val chestSlots = rows * COLUMNS_IN_CHEST

0 commit comments

Comments
 (0)