Package me.hsgamer.hscore.bukkit.gui
Class GUIHolder
- All Implemented Interfaces:
Holder<GUIDisplay>,Initializable,Updatable
The base
Holder for UI in Bukkit-
Field Summary
Fields inherited from class me.hsgamer.hscore.ui.BaseHolder
displayMap -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the button mapGet the close filterorg.bukkit.event.inventory.InventoryTypeGet the inventory typeorg.bukkit.plugin.PluginGet the pluginintGet the size of the inventory for the unique idGet the size functionGet the title for the unique idGet the title functionvoidinit()booleanCheck if the holder should remove the display on its closeprotected GUIDisplaynewDisplay(UUID uuid) protected voidonClick(org.bukkit.event.inventory.InventoryClickEvent event) Handle click eventprotected voidonClose(org.bukkit.event.inventory.InventoryCloseEvent event) Handle close eventprotected voidonDrag(org.bukkit.event.inventory.InventoryDragEvent event) Handle drag eventprotected voidonOpen(org.bukkit.event.inventory.InventoryOpenEvent event) Handle open eventvoidsetButtonMap(ButtonMap buttonMap) Set the button mapvoidsetCloseFilter(Predicate<UUID> closeFilter) Set the close filtervoidsetInventoryType(org.bukkit.event.inventory.InventoryType inventoryType) Set the inventory typevoidsetRemoveDisplayOnClose(boolean removeDisplayOnClose) Set that the display should be removed on close eventvoidsetSize(int size) Set the sizevoidsetSizeFunction(ToIntFunction<UUID> sizeFunction) Set the size functionvoidSet the titlevoidsetTitleFunction(Function<UUID, String> titleFunction) Set the title functionvoidstop()Methods inherited from class me.hsgamer.hscore.ui.BaseHolder
addEventConsumer, clearAllEventConsumer, clearEventConsumer, createDisplay, getDisplay, handleEvent, removeAllDisplay, removeDisplay, update
-
Constructor Details
-
GUIHolder
public GUIHolder(org.bukkit.plugin.Plugin plugin) Create a new holder- Parameters:
plugin- the plugin
-
-
Method Details
-
getPlugin
public org.bukkit.plugin.Plugin getPlugin()Get the plugin- Returns:
- the plugin
-
isRemoveDisplayOnClose
public boolean isRemoveDisplayOnClose()Check if the holder should remove the display on its close- Returns:
- true if it should
-
setRemoveDisplayOnClose
public void setRemoveDisplayOnClose(boolean removeDisplayOnClose) Set that the display should be removed on close event- Parameters:
removeDisplayOnClose- whether the display should be removed on close event
-
getInventoryType
public org.bukkit.event.inventory.InventoryType getInventoryType()Get the inventory type- Returns:
- the inventory type
-
setInventoryType
public void setInventoryType(org.bukkit.event.inventory.InventoryType inventoryType) Set the inventory type- Parameters:
inventoryType- the inventory type
-
getTitleFunction
Get the title function- Returns:
- the title function
-
setTitleFunction
Set the title function- Parameters:
titleFunction- the title function
-
getTitle
Get the title for the unique id- Parameters:
uuid- the unique id- Returns:
- the title
- See Also:
-
setTitle
Set the title- Parameters:
title- the title- See Also:
-
getSizeFunction
Get the size function- Returns:
- the size function
-
setSizeFunction
Set the size function- Parameters:
sizeFunction- the size function
-
getSize
Get the size of the inventory for the unique id- Parameters:
uuid- the unique id- Returns:
- the size
- See Also:
-
setSize
public void setSize(int size) Set the size- Parameters:
size- the size- See Also:
-
getCloseFilter
Get the close filter- Returns:
- the close filter
-
setCloseFilter
Set the close filter- Parameters:
closeFilter- the close filter
-
getButtonMap
Get the button map- Returns:
- the button map
-
setButtonMap
Set the button map- Parameters:
buttonMap- the button map
-
newDisplay
- Specified by:
newDisplayin classBaseHolder<GUIDisplay>
-
init
public void init() -
stop
public void stop()- Specified by:
stopin interfaceInitializable- Overrides:
stopin classBaseHolder<GUIDisplay>
-
onOpen
protected void onOpen(org.bukkit.event.inventory.InventoryOpenEvent event) Handle open event- Parameters:
event- the event
-
onClick
protected void onClick(org.bukkit.event.inventory.InventoryClickEvent event) Handle click event- Parameters:
event- the event
-
onClose
protected void onClose(org.bukkit.event.inventory.InventoryCloseEvent event) Handle close event- Parameters:
event- the event
-
onDrag
protected void onDrag(org.bukkit.event.inventory.InventoryDragEvent event) Handle drag event- Parameters:
event- the event
-