Skip to content

Commit c9fccf6

Browse files
committed
Spotless
1 parent 4f32191 commit c9fccf6

File tree

6 files changed

+46
-22
lines changed

6 files changed

+46
-22
lines changed

.editorconfig

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ end_of_line = lf
44
indent_size = 4
55
indent_style = space
66
insert_final_newline = true
7-
max_line_length = 160
7+
max_line_length = 130
88
tab_width = 4
99
ij_continuation_indent_size = 8
1010
ij_formatter_off_tag = @formatter:off
1111
ij_formatter_on_tag = @formatter:on
1212
ij_formatter_tags_enabled = false
1313
ij_smart_tabs = false
14-
ij_wrap_on_typing = false
14+
ij_wrap_on_typing = true
1515

1616
[*.conf]
1717
indent_size = 2

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

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import com.noxcrew.interfaces.drawable.Drawable
44
import com.noxcrew.interfaces.element.StaticElement
55
import com.noxcrew.interfaces.interfaces.Interface
66
import com.noxcrew.interfaces.interfaces.buildChestInterface
7-
import com.noxcrew.interfaces.interfaces.buildCombinedInterface
87
import kotlinx.coroutines.DelicateCoroutinesApi
98
import kotlinx.coroutines.GlobalScope
109
import kotlinx.coroutines.delay

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

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import org.incendo.cloud.execution.ExecutionCoordinator
2121
import org.incendo.cloud.kotlin.coroutines.extension.suspendingHandler
2222
import org.incendo.cloud.kotlin.extension.buildAndRegister
2323
import org.incendo.cloud.paper.LegacyPaperCommandManager
24-
import org.incendo.cloud.paper.PaperCommandManager
2524

2625
public class ExamplePlugin : JavaPlugin(), Listener {
2726

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

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import com.noxcrew.interfaces.drawable.Drawable.Companion.drawable
44
import com.noxcrew.interfaces.element.StaticElement
55
import com.noxcrew.interfaces.interfaces.Interface
66
import com.noxcrew.interfaces.interfaces.buildChestInterface
7-
import com.noxcrew.interfaces.interfaces.buildCombinedInterface
87
import com.noxcrew.interfaces.utilities.BoundInteger
98
import org.bukkit.Material
109

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

+44-16
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
8181
MaterialTags.WOODEN_DOORS,
8282
MaterialTags.WOODEN_TRAPDOORS,
8383
MaterialTags.FENCE_GATES,
84-
MaterialSetTag.BUTTONS,
84+
MaterialSetTag.BUTTONS
8585
)
8686
// Add blocks with inventories
8787
.add(
@@ -96,7 +96,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
9696
Material.LOOM,
9797
Material.CARTOGRAPHY_TABLE,
9898
Material.ENCHANTING_TABLE,
99-
Material.SMITHING_TABLE,
99+
Material.SMITHING_TABLE
100100
)
101101
.add(Material.LEVER)
102102
.add(Material.CAKE)
@@ -105,25 +105,25 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
105105
Material.COPPER_DOOR,
106106
Material.EXPOSED_COPPER_DOOR,
107107
Material.WEATHERED_COPPER_DOOR,
108-
Material.OXIDIZED_COPPER_DOOR,
108+
Material.OXIDIZED_COPPER_DOOR
109109
)
110110
.add(
111111
Material.WAXED_COPPER_DOOR,
112112
Material.WAXED_EXPOSED_COPPER_DOOR,
113113
Material.WAXED_WEATHERED_COPPER_DOOR,
114-
Material.WAXED_OXIDIZED_COPPER_DOOR,
114+
Material.WAXED_OXIDIZED_COPPER_DOOR
115115
)
116116
.add(
117117
Material.COPPER_TRAPDOOR,
118118
Material.EXPOSED_COPPER_TRAPDOOR,
119119
Material.WEATHERED_COPPER_TRAPDOOR,
120-
Material.OXIDIZED_COPPER_TRAPDOOR,
120+
Material.OXIDIZED_COPPER_TRAPDOOR
121121
)
122122
.add(
123123
Material.WAXED_COPPER_TRAPDOOR,
124124
Material.WAXED_EXPOSED_COPPER_TRAPDOOR,
125125
Material.WAXED_WEATHERED_COPPER_TRAPDOOR,
126-
Material.WAXED_OXIDIZED_COPPER_TRAPDOOR,
126+
Material.WAXED_OXIDIZED_COPPER_TRAPDOOR
127127
)
128128
// You can click signs to edit them
129129
.add(MaterialTags.SIGNS)
@@ -253,13 +253,23 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
253253
if (view.backing.includesPlayerInventory) {
254254
// If you use a number key we check if the item you're swapping with is
255255
// protected.
256-
if (event.click == ClickType.NUMBER_KEY && !canFreelyMove(view, view.backing.relativizePlayerInventorySlot(GridPoint.at(3, event.hotbarButton)), true)) {
256+
if (event.click == ClickType.NUMBER_KEY && !canFreelyMove(
257+
view,
258+
view.backing.relativizePlayerInventorySlot(GridPoint.at(3, event.hotbarButton)),
259+
true
260+
)
261+
) {
257262
event.isCancelled = true
258263
return
259264
}
260265

261266
// If you try to swap with the off-hand we have to specifically check for that.
262-
if (event.click == ClickType.SWAP_OFFHAND && !canFreelyMove(view, view.backing.relativizePlayerInventorySlot(GridPoint.at(4, 4)), true)) {
267+
if (event.click == ClickType.SWAP_OFFHAND && !canFreelyMove(
268+
view,
269+
view.backing.relativizePlayerInventorySlot(GridPoint.at(4, 4)),
270+
true
271+
)
272+
) {
263273
event.isCancelled = true
264274
return
265275
}
@@ -274,14 +284,26 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
274284

275285
// Don't check top inventory if we're in the player inventory!
276286
if (
277-
(!isInPlayerInventory && topInventory.withIndex().any { (index, it) ->
278-
// Check if any item is being collected that cannot be moved!
279-
it != null && it.isSimilar(clickedItem) && !canFreelyMove(view, requireNotNull(GridPoint.fromBukkitChestSlot(index)), false)
280-
}) ||
287+
(
288+
!isInPlayerInventory && topInventory.withIndex().any { (index, it) ->
289+
// Check if any item is being collected that cannot be moved!
290+
it != null && it.isSimilar(clickedItem) && !canFreelyMove(
291+
view,
292+
requireNotNull(GridPoint.fromBukkitChestSlot(index)),
293+
false
294+
)
295+
}
296+
) ||
281297
bottomInventory.withIndex().any { (index, it) ->
282298
it != null && it.isSimilar(clickedItem) &&
283-
// These slots are always in the player inventory and always need to be relativized!
284-
!canFreelyMove(view, view.backing.relativizePlayerInventorySlot(requireNotNull(GridPoint.fromBukkitPlayerSlot(index))), true)
299+
// These slots are always in the player inventory and always need to be relativized!
300+
!canFreelyMove(
301+
view,
302+
view.backing.relativizePlayerInventorySlot(
303+
requireNotNull(GridPoint.fromBukkitPlayerSlot(index))
304+
),
305+
true
306+
)
285307
}
286308
) {
287309
event.isCancelled = true
@@ -509,7 +531,11 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
509531
isPlayerInventory: Boolean
510532
): Boolean {
511533
// If we don't allow clicking empty slots we never allow freely moving
512-
if (view.builder.preventClickingEmptySlots && !(view.builder.allowClickingOwnInventoryIfClickingEmptySlotsIsPrevented && isPlayerInventory)) return false
534+
if (view.builder.preventClickingEmptySlots &&
535+
!(view.builder.allowClickingOwnInventoryIfClickingEmptySlotsIsPrevented && isPlayerInventory)
536+
) {
537+
return false
538+
}
513539

514540
// If this inventory has no player inventory then the player inventory is always allowed to be edited
515541
if (!view.backing.includesPlayerInventory && isPlayerInventory) return true
@@ -531,7 +557,9 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
531557

532558
// Optionally cancel clicking on other slots
533559
if (raw == null) {
534-
if (view.builder.preventClickingEmptySlots && !(view.builder.allowClickingOwnInventoryIfClickingEmptySlotsIsPrevented && isPlayerInventory)) {
560+
if (view.builder.preventClickingEmptySlots &&
561+
!(view.builder.allowClickingOwnInventoryIfClickingEmptySlotsIsPrevented && isPlayerInventory)
562+
) {
535563
return true
536564
}
537565
return false

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

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package com.noxcrew.interfaces.interfaces
33
import com.noxcrew.interfaces.InterfacesListeners
44
import com.noxcrew.interfaces.grid.GridPoint
55
import com.noxcrew.interfaces.pane.CombinedPane
6-
import com.noxcrew.interfaces.pane.OrderedPane
76
import com.noxcrew.interfaces.pane.Pane
87
import com.noxcrew.interfaces.view.InterfaceView
98
import org.bukkit.entity.Player

0 commit comments

Comments
 (0)