mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-29 12:37:37 +01:00
Closes panels when clicked outside.
https://github.com/tastybento/bskyblock/issues/180
This commit is contained in:
parent
92a7b0e596
commit
8d596c5f1d
@ -9,6 +9,7 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.inventory.InventoryType.SlotType;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
@ -21,6 +22,11 @@ public class PanelListenerManager implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onInventoryClick(InventoryClickEvent event) {
|
||||
// Close inventory if clicked outside
|
||||
if (event.getSlotType().equals(SlotType.OUTSIDE)) {
|
||||
event.getWhoClicked().closeInventory();
|
||||
return;
|
||||
}
|
||||
User user = User.getInstance(event.getWhoClicked()); // The player that
|
||||
// clicked the item
|
||||
Inventory inventory = event.getInventory(); // The inventory that was
|
||||
|
Loading…
Reference in New Issue
Block a user