Skip to content
This repository was archived by the owner on Jul 24, 2021. It is now read-only.

Commit 2e8ec4f

Browse files
committed
🐛 Fix click event
1 parent c081583 commit 2e8ec4f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/main/java/fr/bakaaless/api/inventory/InventoryAPI.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class InventoryAPI implements Listener {
3333
private List<ItemAPI> items;
3434
private Consumer<InventoryAPI> function;
3535
private Consumer<InventoryCloseEvent> closeEvent;
36+
private Consumer<InventoryClickEvent> clickEvent;
3637
private boolean interactionCancel;
3738
private boolean refreshed;
3839
private boolean build;
@@ -217,10 +218,18 @@ public boolean isRefreshed() {
217218
return this.refreshed;
218219
}
219220

220-
JavaPlugin getPlugin() {
221+
/**
222+
* Get the {@link JavaPlugin} which is used to create the inventory.
223+
* @return the {@link JavaPlugin}
224+
*/
225+
public JavaPlugin getPlugin() {
221226
return this.plugin;
222227
}
223228

229+
/**
230+
* Get the {@link Inventory} which is built after the {@link #build(Player)} method.
231+
* @return the {@link Inventory}
232+
*/
224233
Inventory getInventory() {
225234
return this.inventory;
226235
}
@@ -491,10 +500,9 @@ public void onClose(final InventoryCloseEvent e) {
491500

492501
@EventHandler
493502
public void onInteract(final InventoryClickEvent e) {
494-
if (e.getInventory().equals(this.inventory)) {
503+
if (e.getInventory().equals(this.inventory))
495504
if (this.clickEvent != null)
496505
this.clickEvent.accept(e);
497-
}
498506
if (e.getClickedInventory() == null)
499507
return;
500508
if (!e.getClickedInventory().equals(this.inventory))

0 commit comments

Comments
 (0)