Skip to content

Commit 4f32191

Browse files
committed
Fix up editing player inv in chest inventories
1 parent 4890149 commit 4f32191

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

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

+10-1
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,16 @@ public class InterfacesListeners private constructor(private val plugin: Plugin)
507507
view: AbstractInterfaceView<*, *, *>,
508508
clickedPoint: GridPoint,
509509
isPlayerInventory: Boolean
510-
): Boolean = view.pane.getRaw(clickedPoint) == null && !(view.builder.preventClickingEmptySlots && !(view.builder.allowClickingOwnInventoryIfClickingEmptySlotsIsPrevented && isPlayerInventory))
510+
): Boolean {
511+
// If we don't allow clicking empty slots we never allow freely moving
512+
if (view.builder.preventClickingEmptySlots && !(view.builder.allowClickingOwnInventoryIfClickingEmptySlotsIsPrevented && isPlayerInventory)) return false
513+
514+
// If this inventory has no player inventory then the player inventory is always allowed to be edited
515+
if (!view.backing.includesPlayerInventory && isPlayerInventory) return true
516+
517+
// If there is no item here we allow editing
518+
return view.pane.getRaw(clickedPoint) == null
519+
}
511520

512521
/** Handles a [view] being clicked at [clickedPoint] through some [event]. */
513522
private fun handleClick(

0 commit comments

Comments
 (0)