Package Kyu.GuiAPI_Redone.Window
Class Openable
java.lang.Object
Kyu.GuiAPI_Redone.Window.Openable
- Direct Known Subclasses:
MultiWindow
,TextWindow
,TradeWindowHolder
,Window
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetGui()
Consumer<org.bukkit.event.inventory.InventoryCloseEvent>
boolean
Whether or not to cancel the OnInventoryClick event, preventing users from taking/placing items from the inventoryboolean
boolean
boolean
abstract void
open()
void
setDisableClickEvent
(boolean disableClickEvent) Set whether or not InventoryClickEvent is canceled or not.void
setIgnoreCloseEvent
(boolean isIgnoreCloseEvent) void
setOnClose
(Consumer<org.bukkit.event.inventory.InventoryCloseEvent> onClose) void
setPreventClose
(boolean preventClose) void
setUnregisterOnClose
(boolean unregisterOnClose)
-
Field Details
-
onClose
-
disableClickEvent
protected boolean disableClickEvent -
isIgnoreCloseEvent
protected boolean isIgnoreCloseEvent -
preventClose
protected boolean preventClose -
unregisterOnClose
protected boolean unregisterOnClose -
gui
-
-
Constructor Details
-
Openable
-
-
Method Details
-
open
public abstract void open() -
isDisableClickEvent
public boolean isDisableClickEvent()Whether or not to cancel the OnInventoryClick event, preventing users from taking/placing items from the inventory- Returns:
- whether disableClickEvent is on or off
-
setDisableClickEvent
public void setDisableClickEvent(boolean disableClickEvent) Set whether or not InventoryClickEvent is canceled or not. Canceling prevents users from taking/placing items from the inventory- Parameters:
disableClickEvent
- Whether or not to cancel InventoryClickEvent
-
isPreventClose
public boolean isPreventClose()- Returns:
- Whether or not the user can close the window with ESC
-
setPreventClose
public void setPreventClose(boolean preventClose) - Parameters:
preventClose
- Whether or not the user shall be able to close the window with ESC
-
isIgnoreCloseEvent
public boolean isIgnoreCloseEvent()- Returns:
- Whether or not the close Event will be ignored. If true, the onClose Consumer will not be called
-
setIgnoreCloseEvent
public void setIgnoreCloseEvent(boolean isIgnoreCloseEvent) - Parameters:
isIgnoreCloseEvent
- Whether or not the close Event will be ignored. If true, the onClose Consumer will not be called Keep in mind that setting this to true will also result in theWindowListener
not being unregistered on Inventory closed, so you will have to handle this manually
-
getOnClose
- Returns:
- Function to call when the inventory gets closed and
isIgnoreCloseEvent()
is False. Or Null if no function is set
-
setOnClose
- Parameters:
onClose
- Function to call when the inventory gets closed andisIgnoreCloseEvent()
as well asisPreventClose()
are False. Automatically disablesisPreventClose()
andisUnregisterOnClose()
so you have to manually callGUI.unregisterListener()
when your Windows are closed
-
setUnregisterOnClose
public void setUnregisterOnClose(boolean unregisterOnClose) - Parameters:
unregisterOnClose
- Set whether or not to automatically unregister the listeners when the window is closed and nosetOnClose(Consumer)
is set
-
isUnregisterOnClose
public boolean isUnregisterOnClose()- Returns:
- Whether or not to automatically unregister the listeners when the window is closed and no
setOnClose(Consumer)
is set
-
getGui
- Returns:
- The
GUI
the Window is connected to
-