Skip to content

Commit

Permalink
Spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeltumn committed Jul 31, 2024
1 parent df74314 commit d217732
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@ public object InterfacesConstants {
/** The [CoroutineScope] for any suspending operations performed by interfaces. */
public val SCOPE: CoroutineScope = CoroutineScope(
CoroutineName("interfaces") +
SupervisorJob() +
run {
val threadNumber = AtomicInteger()
val factory = { runnable: Runnable ->
Thread("interfaces-${threadNumber.getAndIncrement()}").apply {
isDaemon = true
}
SupervisorJob() +
run {
val threadNumber = AtomicInteger()
val factory = { runnable: Runnable ->
Thread("interfaces-${threadNumber.getAndIncrement()}").apply {
isDaemon = true
}
}

System.getProperty("com.noxcrew.interfaces.fixedPoolSize")
?.toIntOrNull()
?.coerceAtLeast(2)
?.let { size ->
if (System.getProperty("com.noxcrew.interfaces.useScheduledPool").toBoolean()) {
Executors.newScheduledThreadPool(size, factory)
} else {
Executors.newFixedThreadPool(size, factory)
}
System.getProperty("com.noxcrew.interfaces.fixedPoolSize")
?.toIntOrNull()
?.coerceAtLeast(2)
?.let { size ->
if (System.getProperty("com.noxcrew.interfaces.useScheduledPool").toBoolean()) {
Executors.newScheduledThreadPool(size, factory)
} else {
Executors.newFixedThreadPool(size, factory)
}
?.asCoroutineDispatcher()
?: Dispatchers.Default
}
}
?.asCoroutineDispatcher()
?: Dispatchers.Default
}
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -294,25 +294,25 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
// Don't check top inventory if we're in the player inventory!
if (
(
!isInPlayerInventory && topInventory.withIndex().any { (index, it) ->
// Check if any item is being collected that cannot be moved!
it != null && it.isSimilar(clickedItem) && !canFreelyMove(
view,
requireNotNull(GridPoint.fromBukkitChestSlot(index)),
false
)
}
) ||
!isInPlayerInventory && topInventory.withIndex().any { (index, it) ->
// Check if any item is being collected that cannot be moved!
it != null && it.isSimilar(clickedItem) && !canFreelyMove(
view,
requireNotNull(GridPoint.fromBukkitChestSlot(index)),
false
)
}
) ||
bottomInventory.withIndex().any { (index, it) ->
it != null && it.isSimilar(clickedItem) &&
// These slots are always in the player inventory and always need to be relativized!
!canFreelyMove(
view,
view.backing.relativizePlayerInventorySlot(
requireNotNull(GridPoint.fromBukkitPlayerSlot(index))
),
true
)
// These slots are always in the player inventory and always need to be relativized!
!canFreelyMove(
view,
view.backing.relativizePlayerInventorySlot(
requireNotNull(GridPoint.fromBukkitPlayerSlot(index))
),
true
)
}
) {
event.isCancelled = true
Expand Down

0 comments on commit d217732

Please sign in to comment.