diff --git a/pom.xml b/pom.xml index d5f3c23..552fb69 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.asintoto Basic - 1.2.8 + 1.2.9 jar Basic diff --git a/src/main/java/com/asintoto/basic/listeners/InventoryClickListener.java b/src/main/java/com/asintoto/basic/listeners/InventoryClickListener.java index 880ea87..68ef594 100644 --- a/src/main/java/com/asintoto/basic/listeners/InventoryClickListener.java +++ b/src/main/java/com/asintoto/basic/listeners/InventoryClickListener.java @@ -35,10 +35,10 @@ public void onClick(InventoryClickEvent e) { if(isInventoryClick(slot, rawSlot, menu)) { return; } - } - if(!itemData.has(BasicKeys.BUTTON_IS_BUTTON, PersistentDataType.BOOLEAN)) { - return; + if(!itemData.has(BasicKeys.BUTTON_IS_BUTTON, PersistentDataType.BOOLEAN)) { + return; + } } boolean isUlnocked = itemData.has(BasicKeys.BUTTON_TYPE_UNLOCKED, PersistentDataType.BOOLEAN); diff --git a/src/main/java/com/asintoto/basic/listeners/InventoryCloseListener.java b/src/main/java/com/asintoto/basic/listeners/InventoryCloseListener.java index 38156f8..6ed2f48 100644 --- a/src/main/java/com/asintoto/basic/listeners/InventoryCloseListener.java +++ b/src/main/java/com/asintoto/basic/listeners/InventoryCloseListener.java @@ -1,5 +1,6 @@ package com.asintoto.basic.listeners; +import com.asintoto.basic.menu.Menu; import com.asintoto.basic.menu.MenuManager; import com.asintoto.basic.utils.BasicKeys; import org.bukkit.entity.Player; @@ -13,10 +14,12 @@ public class InventoryCloseListener implements Listener { public void onClose(InventoryCloseEvent e) { Player p = (Player) e.getPlayer(); - /*if(p.getPersistentDataContainer().has(BasicKeys.BASIC_MENU_OPEN, PersistentDataType.BOOLEAN)) { - p.getPersistentDataContainer().remove(BasicKeys.BASIC_MENU_OPEN); - }*/ + if(!MenuManager.contains(p)) return; + + Menu menu = MenuManager.getPlayerMenu(p); MenuManager.removePlayer(p); + + menu.onClose(p); } } diff --git a/src/main/java/com/asintoto/basic/menu/Menu.java b/src/main/java/com/asintoto/basic/menu/Menu.java index 326f5fc..a6454c7 100644 --- a/src/main/java/com/asintoto/basic/menu/Menu.java +++ b/src/main/java/com/asintoto/basic/menu/Menu.java @@ -110,4 +110,8 @@ public void onClick(Player p, int slot, InventoryAction action) { } + public void onClose(Player p) { + + } + }