Skip to content

Commit ab897d9

Browse files
committed
also prevent adding items to opened POS
1 parent efe9a14 commit ab897d9

File tree

1 file changed

+4
-2
lines changed
  • src/main/java/pro/cloudnode/smp/bankaccounts/events

1 file changed

+4
-2
lines changed

src/main/java/pro/cloudnode/smp/bankaccounts/events/GUI.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,13 @@ public void onInventoryClick(final @NotNull InventoryDragEvent event) {
161161
*/
162162
@EventHandler(priority = EventPriority.HIGHEST)
163163
public void posItemsChangeWhileOpened(final @NotNull InventoryMoveItemEvent event) {
164-
final @NotNull Inventory inventory = event.getSource();
164+
final @NotNull Inventory source = event.getSource();
165+
final @NotNull Inventory destination = event.getDestination();
165166
for (final @NotNull POS pos : POS.activePosChestGuis.values()) {
166167
final @Nullable Chest chest = pos.getChest();
167168
if (chest == null) continue;
168-
if (inventory.equals(chest.getInventory())) {
169+
final @NotNull Inventory chestInventory = chest.getInventory();
170+
if (source.equals(chestInventory) || destination.equals(chestInventory)) {
169171
event.setCancelled(true);
170172
return;
171173
}

0 commit comments

Comments
 (0)