Skip to content

Commit

Permalink
2.1.1-SNAPSHOT fix
Browse files Browse the repository at this point in the history
  • Loading branch information
FigT committed Jun 28, 2024
1 parent 4747d6b commit b0558d9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 34 deletions.
2 changes: 1 addition & 1 deletion adventure/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
archivesBaseName = 'zaiko-adventure'
version = '2.1.0' // < change this version
version = '2.1.1-SNAPSHOT' // < change this version
description = 'Adventure support for Zaiko titles'

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
archivesBaseName = 'zaiko'
version = '2.1.0' // < change this version
version = '2.1.1-SNAPSHOT' // < change this version
description = 'A modern and flexible GUI library for Spigot'
36 changes: 4 additions & 32 deletions api/src/main/java/gg/saki/zaiko/MenuListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;

import java.util.ArrayList;
import java.util.List;

/**
* The main listener for handling interactions with {@link Menu}s.
*/
Expand All @@ -58,36 +55,22 @@ private void onClick(InventoryClickEvent event) {

if (menu == null) return;

Inventory inventory = event.getInventory();

Inventory clickedInventory = event.getClickedInventory();

if (clickedInventory == null) {
return;
}

if (menu.settings().playerInventoryInteraction()
&& clickedInventory.getType() == InventoryType.PLAYER) return;

Placeable placeable = menu.getPlaceable(event.getSlot());
Placeable placeable = menu.getPlaceable(event.getRawSlot());

if (placeable != null) {
placeable.click(event);
return;
}


if (!menu.settings().transferItems()) {
if (event.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY && clickedInventory.getType() == InventoryType.PLAYER) {
event.setCancelled(true);
event.setCursor(null);
return;
}

if (clickedInventory.getType() != InventoryType.PLAYER) {
event.setCancelled(true);
player.getInventory().addItem(event.getCursor());
event.setCursor(null);
}
}
event.setCancelled(true);
}


Expand All @@ -101,17 +84,6 @@ private void onDrag(InventoryDragEvent event) {

if (menu == null) return;

Inventory inventory = event.getInventory();


List<Integer> slots = new ArrayList<>(event.getInventorySlots());
if (!menu.settings().transferItems() && inventory.getType() != InventoryType.PLAYER && inventory.getItem(slots.get(0)) == null) {
event.setCancelled(true);
player.getInventory().addItem(event.getOldCursor());
event.setCursor(null);
return;
}

ItemStack cursor = event.getOldCursor();

for (Placeable placeable : menu.getPlaceableArray()) {
Expand Down

0 comments on commit b0558d9

Please sign in to comment.