Skip to content

Commit

Permalink
item area action support
Browse files Browse the repository at this point in the history
  • Loading branch information
j1sk1ss committed Jul 13, 2024
1 parent 553e742 commit d7c685b
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
package org.j1sk1ss.menuframework.objects.interactive.components;

import lombok.experimental.ExtensionMethod;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.j1sk1ss.itemmanager.manager.Manager;
import org.j1sk1ss.menuframework.objects.interactive.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;


@ExtensionMethod({Manager.class})
public class ItemArea extends Component {
public ItemArea(int firstSlot, int secondSlot, List<ItemStack> items) {
FirstSlot = firstSlot;
public ItemArea(int firstSlot, int secondSlot, List<ItemStack> items, Consumer<InventoryClickEvent> delegate) {
FirstSlot = firstSlot;
SecondSlot = secondSlot;
Items = items;
Items = items;
Action = delegate;
}

private final Consumer<InventoryClickEvent> Action;
private final int FirstSlot;
private final int SecondSlot;
private final List<ItemStack> Items;
Expand Down Expand Up @@ -50,4 +54,9 @@ public List<Integer> getCoordinates() {

return list;
}

@Override
public void action(InventoryClickEvent event) {
if (Action != null) Action.accept(event);
}
}

0 comments on commit d7c685b

Please sign in to comment.