DREAMFIRE Docs ← Back to site
Loading...
Searching...
No Matches
InventoryOpener.java
Go to the documentation of this file.
1package com.dreamfirestudios.dreamcore.DreamSmartInvs.opener;
2
3import com.dreamfirestudios.dreamcore.DreamSmartInvs.ClickableItem;
4import com.dreamfirestudios.dreamcore.DreamSmartInvs.SmartInventory;
5import com.dreamfirestudios.dreamcore.DreamSmartInvs.content.InventoryContents;
6import org.bukkit.entity.Player;
7import org.bukkit.event.inventory.InventoryType;
8import org.bukkit.inventory.Inventory;
9
10public interface InventoryOpener {
11
12 Inventory open(SmartInventory inv, Player player);
13 boolean supports(InventoryType type);
14
15 default void fill(Inventory handle, InventoryContents contents) {
16 ClickableItem[][] items = contents.all();
17
18 for(int row = 0; row < items.length; row++) {
19 for(int column = 0; column < items[row].length; column++) {
20 if(items[row][column] != null)
21 handle.setItem(9 * row + column, items[row][column].getItem());
22 }
23 }
24 }
25
26}
default void fill(Inventory handle, InventoryContents contents)
Inventory open(SmartInventory inv, Player player)