Package de.clickism.clickgui.menu
Class Menu
java.lang.Object
de.clickism.clickgui.menu.Menu
Represents a menu.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected MenuBackgroundThe background of the menu.protected final Button[]The buttons in the menu.protected ClickHandlerThe click handler for the menu.protected final InventorySupplierThe supplier for the inventory.The action to perform when the menu is closed.The action to perform when the menu is open.protected final org.bukkit.entity.PlayerThe player viewing the menu.protected final intThe size of the menu.protected StringThe title of the menu. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMenu(org.bukkit.entity.Player player, InventorySupplier inventorySupplier, int size) Creates a new menu.Creates a new menu.Menu(org.bukkit.entity.Player player, org.bukkit.event.inventory.InventoryType inventoryType) Creates a new menu. -
Method Summary
Modifier and TypeMethodDescriptionAdds a button to the menu.@Nullable ButtongetButton(int slot) Gets the button at a slot.org.bukkit.entity.PlayerGets the player viewing the menu.open()Opens the menu using the instance of the menu manager set byMenuManager.setInstance(MenuManager).open(MenuManager menuManager) Opens the menu.setBackground(MenuBackground background) Sets the background of the menu.setClickHandler(ClickHandler clickHandler) Sets the click handler of the menu.setOnClose(Consumer<MenuView> onClose) Sets the action to perform when the menu is closed.Sets the action to perform when the menu is opened.Sets the title of the menu.
-
Field Details
-
player
protected final org.bukkit.entity.Player playerThe player viewing the menu. -
size
protected final int sizeThe size of the menu. -
buttons
The buttons in the menu. -
title
The title of the menu. -
background
The background of the menu. -
inventorySupplier
The supplier for the inventory. -
clickHandler
The click handler for the menu. -
onOpen
The action to perform when the menu is open. -
onClose
The action to perform when the menu is closed.
-
-
Constructor Details
-
Menu
public Menu(org.bukkit.entity.Player player, org.bukkit.event.inventory.InventoryType inventoryType) Creates a new menu.- Parameters:
player- the player viewing the menuinventoryType- the type of inventory
-
Method Details
-
setTitle
Sets the title of the menu.- Parameters:
title- the title- Returns:
- this menu
-
setOnOpen
Sets the action to perform when the menu is opened.- Parameters:
onOpen- the action to perform- Returns:
- this menu
-
setOnClose
Sets the action to perform when the menu is closed.- Parameters:
onClose- the action to perform- Returns:
- this menu
-
getButton
Gets the button at a slot.- Parameters:
slot- the slot- Returns:
- the button
-
open
Opens the menu using the instance of the menu manager set byMenuManager.setInstance(MenuManager).- Returns:
- the view of the menu
- Throws:
IllegalStateException- if no instance was set
-
getPlayer
public org.bukkit.entity.Player getPlayer()Gets the player viewing the menu.- Returns:
- the player