@@ -75,7 +75,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
75
75
Reason .PLUGIN ,
76
76
Reason .TELEPORT ,
77
77
Reason .CANT_USE ,
78
- Reason .UNLOADED
78
+ Reason .UNLOADED ,
79
79
)
80
80
81
81
/* * 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)
85
85
MaterialTags .WOODEN_DOORS ,
86
86
MaterialTags .WOODEN_TRAPDOORS ,
87
87
MaterialTags .FENCE_GATES ,
88
- MaterialSetTag .BUTTONS
88
+ MaterialSetTag .BUTTONS ,
89
89
)
90
90
// Add blocks with inventories
91
91
.add(
@@ -100,7 +100,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
100
100
Material .LOOM ,
101
101
Material .CARTOGRAPHY_TABLE ,
102
102
Material .ENCHANTING_TABLE ,
103
- Material .SMITHING_TABLE
103
+ Material .SMITHING_TABLE ,
104
104
)
105
105
.add(Material .LEVER )
106
106
.add(Material .CAKE )
@@ -109,25 +109,25 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
109
109
Material .COPPER_DOOR ,
110
110
Material .EXPOSED_COPPER_DOOR ,
111
111
Material .WEATHERED_COPPER_DOOR ,
112
- Material .OXIDIZED_COPPER_DOOR
112
+ Material .OXIDIZED_COPPER_DOOR ,
113
113
)
114
114
.add(
115
115
Material .WAXED_COPPER_DOOR ,
116
116
Material .WAXED_EXPOSED_COPPER_DOOR ,
117
117
Material .WAXED_WEATHERED_COPPER_DOOR ,
118
- Material .WAXED_OXIDIZED_COPPER_DOOR
118
+ Material .WAXED_OXIDIZED_COPPER_DOOR ,
119
119
)
120
120
.add(
121
121
Material .COPPER_TRAPDOOR ,
122
122
Material .EXPOSED_COPPER_TRAPDOOR ,
123
123
Material .WEATHERED_COPPER_TRAPDOOR ,
124
- Material .OXIDIZED_COPPER_TRAPDOOR
124
+ Material .OXIDIZED_COPPER_TRAPDOOR ,
125
125
)
126
126
.add(
127
127
Material .WAXED_COPPER_TRAPDOOR ,
128
128
Material .WAXED_EXPOSED_COPPER_TRAPDOOR ,
129
129
Material .WAXED_WEATHERED_COPPER_TRAPDOOR ,
130
- Material .WAXED_OXIDIZED_COPPER_TRAPDOOR
130
+ Material .WAXED_OXIDIZED_COPPER_TRAPDOOR ,
131
131
)
132
132
// You can click signs to edit them
133
133
.add(MaterialTags .SIGNS )
@@ -138,7 +138,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
138
138
val view : InterfaceView ,
139
139
val onCancel : suspend () -> Unit ,
140
140
val onComplete : suspend (Component ) -> Boolean ,
141
- val id : UUID
141
+ val id : UUID ,
142
142
)
143
143
144
144
/* * The view currently being opened. */
@@ -313,7 +313,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
313
313
if (event.click == ClickType .NUMBER_KEY && ! canFreelyMove(
314
314
view,
315
315
view.backing.relativizePlayerInventorySlot(GridPoint .at(3 , event.hotbarButton)),
316
- true
316
+ true ,
317
317
)
318
318
) {
319
319
event.isCancelled = true
@@ -324,7 +324,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
324
324
if (event.click == ClickType .SWAP_OFFHAND && ! canFreelyMove(
325
325
view,
326
326
view.backing.relativizePlayerInventorySlot(GridPoint .at(4 , 4 )),
327
- true
327
+ true ,
328
328
)
329
329
) {
330
330
event.isCancelled = true
@@ -347,7 +347,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
347
347
it != null && it.isSimilar(clickedItem) && ! canFreelyMove(
348
348
view,
349
349
requireNotNull(GridPoint .fromBukkitChestSlot(index)),
350
- false
350
+ false ,
351
351
)
352
352
}
353
353
) ||
@@ -357,9 +357,9 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
357
357
! canFreelyMove(
358
358
view,
359
359
view.backing.relativizePlayerInventorySlot(
360
- requireNotNull(GridPoint .fromBukkitPlayerSlot(index))
360
+ requireNotNull(GridPoint .fromBukkitPlayerSlot(index)),
361
361
),
362
- true
362
+ true ,
363
363
)
364
364
}
365
365
) {
@@ -392,7 +392,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
392
392
} else {
393
393
targetSlot
394
394
},
395
- isMovingIntoPlayerInventory
395
+ isMovingIntoPlayerInventory,
396
396
)
397
397
) {
398
398
event.isCancelled = true
@@ -451,7 +451,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
451
451
GridPoint .at(3 , player.inventory.heldItemSlot)
452
452
} else {
453
453
PlayerPane .OFF_HAND_SLOT
454
- }
454
+ },
455
455
)
456
456
val click = convertAction(event.action, player.isSneaking)
457
457
@@ -585,7 +585,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
585
585
private fun canFreelyMove (
586
586
view : AbstractInterfaceView <* , * , * >,
587
587
clickedPoint : GridPoint ,
588
- isPlayerInventory : Boolean
588
+ isPlayerInventory : Boolean ,
589
589
): Boolean {
590
590
// If we don't allow clicking empty slots we never allow freely moving
591
591
if (view.builder.preventClickingEmptySlots &&
@@ -608,7 +608,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
608
608
click : ClickType ,
609
609
slot : Int ,
610
610
isPlayerInventory : Boolean ,
611
- interact : Boolean
611
+ interact : Boolean ,
612
612
): Boolean {
613
613
// Determine the type of click, if nothing was clicked we allow it
614
614
val raw = view.completedPane?.getRaw(clickedPoint)
@@ -653,7 +653,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
653
653
Bukkit .getScheduler().runTaskLaterAsynchronously(
654
654
plugin,
655
655
Runnable { completedClickHandler.cancel() },
656
- 120
656
+ 120 ,
657
657
)
658
658
}
659
659
@@ -691,7 +691,7 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
691
691
view : InterfaceView ,
692
692
timeout : Duration ,
693
693
onCancel : suspend () -> Unit ,
694
- onComplete : suspend (Component ) -> Boolean
694
+ onComplete : suspend (Component ) -> Boolean ,
695
695
) {
696
696
// Determine if the player has this inventory open
697
697
if (! view.isOpen()) return
@@ -721,8 +721,8 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
721
721
view,
722
722
onCancel,
723
723
onComplete,
724
- id
725
- )
724
+ id,
725
+ ),
726
726
)
727
727
728
728
// 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)
740
740
view.reopen()
741
741
}
742
742
},
743
- timeout.inWholeMilliseconds / 50
743
+ timeout.inWholeMilliseconds / 50 ,
744
744
)
745
745
}
746
746
0 commit comments